Capture mode

Description

The AXIS Capture mode API lets you use a collection of image sensor settings and also provides an interface for making changes and retrieving related information for the available capture modes.

Model

The API consists of the CGI capturemode.cgi. All capture mode related operations can be performed by using this parameter and one of the following methods:

MethodDescription
getCaptureModesRetrieves currently available capture modes.
setCaptureModeSets a capture mode for one of the channels.

Identification

Firmware

8.50 and later

Common examples

Get Capture mode

Use this example to query the API to return both the current and available capture modes for each channel.

Syntax
//myserver/axis-cgi/capturemode.cgi
JSON request parameters
{
  "apiVersion": "1.0",
  "context": "abc",
  "method": "getCaptureModes"
}
Successful response
{
  "apiVersion": "1.0",
  "context": "abc",
  "method": "getCaptureModes",
  "data":
  [
    {
      "channel": 0,
      "captureMode":
      [
        {
          "captureModeId": 0,
          "enabled": true,
          "maxFPS": 120,
          "description": "1280x720 (16:9) @ 100/120 fps"
        },
        {
          "captureModeId": 1,
          "enabled": false,
          "description": "1920x1080 (16:9) @ 30/60 fps"
        }
      ]
    },
    {
      "channel": 1,
      "captureMode":
      [
        {
          "captureModeId": 0,
          "enabled": false,
          "description": "1280x720 (16:9) @ 100/120 fps"
        },
        {
          "captureModeId": 1,
          "enabled": true,
          "maxFPS": 29.97,
          "description": "1920x1080 (16:9) @ 30/60 fps"
        }
      ]
    }
  ]
}
Error response
{
  "apiVersion": "1.0",
  "context": "abc",
  "method": "getCaptureModes--",
  "error":
  {
    "code": 4001,
    "message": "Method field has invalid value (getCaptureModes--). Valid values: setCaptureMode, getCaptureModes"
  }
}

Set Capture mode

Use this example to switch between the current and available capture modes. The new capture mode will not take effect until after a reboot.

Syntax
//myserver/axis-cgi/capturemode.cgi
JSON request paramasters
{
  "apiVersion": "1.0",
  "context": "abc",
  "method": "setCaptureMode",
  "channel": 1,
  "captureModeId": 2
}
Successful response
{
  "apiVersion": "1.0",
  "context": "abc",
  "method": "setCaptureMode",
  "data": {}
}
Error response
{
  "apiVersion": "1.0",
  "context": "abc",
  "method": "setCaptureMode",
  "error":
  {
    "code": 8000,
    "message": "Internal error. Check the log for details."
  }
}

API specification

getCaptureModes

Method for getting current and available capture modes.

Request

Security level

Viewer

Method

POST

//myserver/axis-cgi/capturemode.cgi
ParameterTypeDescription
apiVersionStringThe version of the API.
contextStringOptional. Context string. Client sets this value and the CGI sends it back in the response.
methodStringThe operation to perform.

Return value - Success

HTTP Code

200 OK

Content-Type

application/json

Syntax
{
  "apiVersion": "Version number",
  "context": "Echoed if provided by the client in the corresponding request",
  "method": "getCaptureModes",
  "data":
  [
    {
      "channel": channel_index,
      "captureMode":
      [
        {
          "captureModeId": The value/identifier to use when calling SetCaptureMode to set this capture mode,
          "enabled": True if this is the current capture mode, otherwise false,
          "maxFPS": Max frames per second. Optional, this item is guaranteed to exist only if "enabled" is true,
          "description": "Friendly description of this capture mode"
        }, ...
      ]
    }, ...
  ]
}

Return value - Error

HTTP Code

200 OK

Content-Type

application/json

Syntax
{
  "apiVersion": "Version number",
  "context": "Echoed if provided by the client in the corresponding request",
  "method": "getCaptureModes",
  "error":
  {
    "code": integer error code,
    "message": "Error message"
  }
}

Error codes

Error codes are listed in Error codes.

setCaptureMode

Method for setting a capture mode for one channel.

Request

Security level

Operator

Method

POST

//myserver/axis-cgi/capturemode.cgi
ParameterTypeDescription
apiVersionStringThe version of the API.
contextStringOptional. Context string. Set this value and the CGI sends it back in the response.
methodStringThe operation to perform.
channelIntegerThe index number of the channel.
captureModeIdIntegerThe index number of the of the capture mode.

Return value - Success

HTTP Code

200 OK

Content-Type

application/json

Syntax
{
  "apiVersion": "Version number",
  "context": "Echoed if provided by the client in the corresponding request",
  "method": "setCaptureMode",
  "data": {}
}

Return value - Error

HTTP Code

200 OK

Content-Type

application/json

Syntax
{
  "apiVersion": "Version number",
  "context": "Echoed if provided by the client in the corresponding request",
  "method": "setCaptureMode",
  "error":
  {
    "code": integer error code,
    "message": "Error message"
  }
}

Error codes

Error codes are listed in Error codes.

Error codes

General error responses for Capture mode API.

CodeDescription
2000Resource allocation failed. Check log for details.
4000Invalid JSON format. Check message field for details.
4001Parameter not found or invalid value/format. Check message field for details.
8000Internal error. Check log for details.