Bluecherry server API

Last updated 7/9/2018

Using the Bluecherry API to control or view a camera requires knowing the device ID. Currently this can be found in the XML file.

Note: The XML file will only generate the device IDs that the user has access to. Make sure you have access to all cameras, or that you are using an administrator login if you plan on controlling all cameras.

https://login:password@bluecherry-server/ajax/devices.php?XML=true&short=true

Once you obtain the device id, you can obtain a multi-part JPEG image from this URL:

https://login:password@bluecherry-server/media/mjpeg.php?id={camera_id}&multipart=true

Below is a example URL for controlling a Pan / Tilt / Zoom camera through the Bluecherry API.

https://login:password@bluecherry-server/media/ptz.php?id={camera_id}&command={command}&panspeed={speed}&tiltspeed={speed}&pan={pan_command}&tilt={tilt_command}&zoom={zoom-command}&duration={duration}&preset={preset_id}&name={preset_name}

Supported Pan / Tilt / Zoom commands:

query – display XML with camera information/PTZ capabilities and presets move – pan/tilt/zoom using parameters stop – stop movement save – save present rename – rename a preset go – go to specified preset clear – clear preset

Pan / Tilt / Zoom Variables:

preset_id – id of the preset preset_name --new preset name speed: pan/tilt speed pan_command:(l)eft /®ight
tilt_command:(u)p /(d)own
zoom_command:(t)ight /(w)ide duration:for how long to execute command; -1 for continuous

Trigger recording:

https://login:password@bluecherry-server:7001/media/trigger.php?camera_id={camera_id}&description=TEST Camera must be set to Trigger (‘T’) in the recording schedule. Description will show in the logs that a trigger was recording with the description you inserted.

Hi,

I feel a little dumb asking this, since it seems that no one has had to do so before, but here it comes…

My goal is to set my PTZ camera to tour between two views every once in a while. I have been planning to use API commands for this.

I was able to retrieve an image from the camera using the API, but I can’t figure out how to formulate a URL to control PTZ movement. I tried to look for more URL examples on how to control PTZ using the API. However, these here are the only ones I could find.

What would be the URL to, say, pan the view to left for five seconds? This one only returns blank page:
https://login:password@bluecherry-server/media/ptz.php?id=2&command=move&panspeed=10&pan=left&duration=5

Just to be clear, the PTZ control of my camera functions just fine from the Bluecherry client software.

Thanks for the help!

Are you looking at this PTZ documentation?

This should be (notice the ‘l’ instead of ‘left’)

https://login:password:7001@bluecherry-server/media/ptz.php?id=2&command=move&panspeed=10&pan=l&duration=5

Hi,

yes!

This should be (notice the ‘l’ instead of ‘left’)

This did it. Thanks!

A few things though:

  • The duration-parameter seems to be milliseconds rather than seconds.
  • I did not notice any difference changing the panspeed-parameter
  • There is a typo on the example URL above: the Bluecherry server port should not be defined right after the login password, but after the server name, just like on the documentation.

I was not able to get the presets to work, but I guess it is not necessary for my application for now.