Exploring the Canon Browser Remote API

Initializing the connection and polling for Updates

After establishing a WiFi connection, as described in the first part, the communication with the camera needs to be initialized. This post describes how you can obtain all necessary cookies and keep property data in sync by polling for updates.

API Initialization

The Canon EOS C100 II requires certain cookies as part of the request headers for the communication to work. The acid cookie is the most important since it is comparable to a session id. In addition, the productId and brlang cookies are a requirement for the getUpdate endpoint.

acid      = 2ee;    // random session id
productId = VKIX00; // product id
brlang    = 0;      // numeric language code

To get hold of the values, perform a login followed by a getDeviceInfo request.

Login

The login endpoint is the only endpoint that does not require any cookies. However, you need to be aware that only one client can be connected simultaneously, and there is a 30-second cooldown between sessions.

GET
http://192.168.0.80
/api/acnt/login
Response Header
Set-Cookie: acid=2ee; path=/
Response Body
{ "res": "ok" }

In the example above, the acid cookie has the value 2ee, which we need to save for future requests.

Get Device Info

To retrieve the product id and language code from the camera, you can perform a getDeviceInfo request. Besides other fields, its response body contains the properties productId and lang, which is some kind of numeric language field.

GET
http://192.168.0.80
/api/sys/getdevinfo
Request Header
Cookie: acid=2ee;
Response Body
{
  "res": "ok",
  "modelName": "",
  "manufacturer": "",
  "serialNum": "",
  "lang": 0,
  "mode": 1,
  "productId": "VKIX00"
}

As you can see, the header uses the acid cookie obtained from the login request. According to the getDeviceInfo response body, we can add productId=VKIX00 and brlang=0 to our client cookies.

Now that we have acquired all necessary cookies, we can continue exploring the Browser Remote API’s endpoints.

Get Updates

When controlling the camera through the Browser Remote API, you can still change settings directly on the camera, like adjusting the shutter angle. Therefore, we must poll for updates periodically to keep the properties between our client and the camera in sync.

For this purpose, we can use the getcurprop endpoint, which takes one query parameter seq. This parameter is also part of the response body and acts as an event sequence counter, meaning each time an event occurs, the response body contains its incremented value for the next request.

Initial Request

The initial getcurprop request with seq set to 0 is a treasure chest for reverse engineering the Browser Remote API since it contains the state of all properties the camera reports.

GET
http://192.168.0.80
/api/cam/getcurprop?seq=0
Request Header
Cookie: acid=2ee; productId=VKIX00; brlang=0;
Response Body
{
  "res": "ok",
  "seq": 1,
  "mode": "Ctrl",
  "rec": "Stby",
  "com": 1,
  "batt": 4,
  "tc": "02:29:22:14",
  "cbtn": "f0i1af4ai1fm1",
  "camid": "C100II  ",
  "Ocf": {
      "sel": "A",
      "artime": 130,
      "brtime": -1
  },
  "Owbm": {
      "pv": "Kelvin",
      "en": 1
  },
  "Owbv": {
      "pv": "3800",
      "en": 1
  },
  "Oav": {
      "pv": "1.8",
      "en": 1
  },
  "Ossm": {
      "pv": "angle",
      "en": 1
  },
  "Ossv": {
      "pv": "180.00",
      "en": 1
  },
  "Ogcm": {
      "pv": "iso",
      "en": 1
  },
  "Ogcv": {
      "pv": "[850]",
      "en": 1
  },
  "Oam": {
      "pv": "Manual",
      "en": 0
  },
  "nd": 2,
  "fframe": "contin",
  "pushai": "stop",
  "aes": "non",
  "aesbtn": "PM",
  "faceficon": "off"
}

When analyzing the JSON data, we can make sense of lots of properties just by their name or value. However, for the non-obvious ones, the best bet for finding out their meanings is changing settings on the camera and polling for subsequent event data.

Subsequent Requests

For subsequent requests, use the seq number the camera reported in the previous update response, e. g. /api/cam/getcurprop?seq=1. Compared to the initial response, subsequent responses only contain the properties that changed.

As a bonus, here are two more response bodies for reference:

No Value Changed
{
  "res": "ok",
  "seq": 1,
  "com": 1
}

When no value has changed, the response does not contain any property data, and the seq counter remains the same.

Battery dropped and aperture value changed
 {
   "res": "ok",
   "seq": 2,
   "com": 2,
   "batt": 3,
   "cbtn": "f0i1af4ai1fm1",
   "Oav": {
     "pv": "2.0",
     "en": 1
   },
   "Oam": {
     "pv": "Manual",
     "en": 0
   }
 }

This response body informs that the battery level batt dropped to 3 and the aperture value Oav changed to 2.0. Additionally, the seq counter changed to 2, which becomes the seq query parameter for the following getcurprop request.

Property Overview

Here is an overview of the getcurprop response’s properties, including the values I have come across. So, be aware that this model description is still a work in progress due to the nature of reverse engineering.

getcurprop Response
rec
enum

Indicates the recording state of the camera.

Stby
Camera is ready to record
Rec
Camera is recording
off
Camera turns off
seq
integer

The seq property increments whenever a property has changed.

com
integer

The com property increments with each getcurprop call. It ranges between 1 and 10 and falls over to 1 once it reaches 10.

batt
integer

The batt property reports the battery level of the camera. A value between 1 to 4 corresponds with the battery level bars. A value of -1 means the camera is connected to the ac adapter.

tc
string

The current timecode of the camera, e. g. 02:29:22:14. While recording, the event data includes updated timecode values.

camid
string

The id of the connected camera, e. g. C100II for the Canon C100 II.

Oam
object

A property object which contains the current aperture mode.

pv
string

The current aperture mode, e. g, Manual.

en
boolean

This flag might indicate whether the property is available or enabled.

Oav
object

A property object which contains the current aperture value.

pv
string

The current aperture value e. g. 1.8.

en
boolean

This flag might indicate whether the property is available or enabled.

Ogcm
object

A property object which contains the current gain mode.

pv
string

The current gain mode, e. g. iso.

en
boolean

This flag might indicate whether the property is available or enabled.

Ogcv
object

A property object which contains the current gain value when using gain mode iso.

pv
string

The current gain value, e. g, [850].

en
boolean

This flag might indicate whether the property is available or enabled.

Ossm
object

A property object which contains the current shutter speed mode.

pv
string

The current shutter speed mode, e. g. angle.

en
boolean

This flag might indicate whether the property is available or enabled.

Ossv
object

A property object which contains the current shutter speed value.

pv
string

The current shutter speed value, e. g. 180.0 when using shutter speed mode angle.

en
boolean

This flag might indicate whether the property is available or enabled.

Owbm
object

A property object which contains the current white balance mode.

pv
enum

The current white balance mode, e. g. Kelvin.

en
boolean

This flag might indicate whether the property is available or enabled.

Owbv
object

A property object which contains the current white balance value.

pv
string

The current white balance value e. g. 5600 when using white balance mode Kelvin.

en
boolean

This flag might indicate whether the property is available or enabled.

nd
integer

Corresponds to the dialed-in ND value, e. g. 0, 2, 4, 6.

With the initialization and update channel established, the groundwork for communicating with the C100 II is complete.

In the next part, we will use the Camera Remote API to take control of the camera. Besides starting and stopping a recording, you’ll learn to change properties like aperture, ISO, shutter angle and white balance.