Exploring the Canon Browser Remote API

Taking control of the Canon EOS C100 II

After the last parts handled the setup and initialization of the Browser Remote API, this post finally describes how to control the Canon EOS C100 II. In this post, you’ll learn how to start and stop a recording and adjust properties like aperture, iso and shutter speed.

Start and Stop Recording

To start or stop a recording, you can use the rec endpoint with the cmd parameter set to trig.

GET
http://192.168.0.80
/api/cam/rec?cmd=trig
Request Header
Cookie: acid={SESSION_ID}; productId=VKIX00; brlang=0;
Response Body
{
  "res": "ok"
}

After calling the api/cam/rec endpoint, the next response of getcurprop contains an updated value for the rec property, which is either Rec when the camera started to record, or Stby, when the camera stopped recording.

Controlling Property Values

For controlling property values, the Browser Remote API provides the two endpoints getprop and setprop.

Property Overview

To set or get a property, the API uses the following keys:

  • gcv: Gain, e. g. iso
  • av: Aperture
  • ssv: Shutter Speed
  • wbv: White Balance

Besides the missing leading O, they correspond perfectly with the property names within the prop update model we discovered in the previous post.

Get Current and Allowed Property Values

The getprop endpoint takes a property key as its query parameter r and provides a response containing both the current value as well as a list of allowed values.

GET
http://192.168.0.80
/api/cam/getprop?r={PROP}
Request Header
Cookie: acid={SESSION_ID}; productId=VKIX00; brlang=0;
Response Body
{
  "res": "ok",
  "Ossv": {
      "pv": "180.00",
      "en": 1,
      "rvn": 14,
      "rv": [
          "360.00",
          "300.00",
          "240.00",
          "180.00",
          "150.00",
          "120.00",
          "90.00",
          "75.00",
          "60.00",
          "45.00",
          "30.00",
          "22.50",
          "15.00",
          "11.25"
      ]
  }
}

The example above shows the response body of a getprop operation with the r parameter set to ssv (shutter speed value). The pv field holds the current value (180.0), the rvn field the number of allowed values and the rv field a list of all allowed values. Independent of the property, its values are always strings in a human-readable format.

Next up, we can use the allowed values for reference when altering properties using a setprop request.

Set Property Value

To modify a property, use the setprop endpoint, add a query parameter named after the property key and assign it with one of its allowed values. For example, call /api/cam/setprop?gcv=1250 to set the iso value to 1250.

GET
http://192.168.0.80
/api/cam/setprop?{PROP}={VALUE}
Request Header
Cookie: acid={SESSION_ID}; productId=VKIX00; brlang=0;
Response Body
{
    "res": "ok"
}

Be aware that the setprop endpoint always responds with status code 200 and ok in its response body, even when you try to set an unsupported value. Therefore, it is crucial to regularly poll for property updates using the getcurprop endpoint to verify the property has changed.

Now that we can control the camera, there is only one feature we need to explore to build a full-fledged app that also involves polling: Live View. But that will be the topic of the upcoming article.