Stay tuned, we are relaunching the VAPIX library soon!

On-screen controls

Description

The AXIS On-screen controls API makes it possible for the user to receive information about various features of the camera. This information is available via a CGI, with the various methods described in the table below:

The On-screen Controls CGI methods
MethodUsage
languagesGet a list of supported languages and locales.
featuresGet descriptions of available features in one of the supported languages.
addFeaturesAdd information about a manually installed feature.
listAddedFeaturesGet a list of manually added features.
removeFeaturesRemove information about a manually installed feature.
getAllFeaturesGet a collection of feature descriptions in all available languages.
getSupportedVersionsGet a list of supported API versions.
enableFeatureShow the option to enable/disable a feature.
disableFeatureRemove the option to enable/disable a feature.

Model

The Api consists of a CGI which should be called using the HTTP/HTTPS Post method, and with JSON formatted data as input. The CGI includes a number of methods which gives the user the ability to:

  • Get a list of supported languages and locales.

  • Get information about available features in a given (supported) locale.

  • Add information about a manually installed feature.

  • List manually added features.

  • Remove information about a manually installed feature.

  • Get information about available features in all supported languages.

  • Get a list of supported API versions.

An API call includes the requested method along with any required input parameters.

Prerequisites

Property

Properties.PackageManager.PackageManager=yes

Property

Properties.AddOnFramework.Version=1.0 or higher

Firmware

7.10 and later

Product category

Axis Cameras with application-support

Application Identification

The status method in the axis/addon.cgi lists axis-onscreencontrols as active.

Common examples

Languages

Use this example to check if feature descriptions can be displayed in a certain language.

1. Query for supported languages.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "",
  "method": "languages",
  "params": {
  }
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "1.0",
  "context": "",
  "method": "languages",
  "data": {
    "languages": [
      {
        "language": "English",
        "locale": "en-us"
      },
      {
        "language": "Svenska",
        "locale": "sv-se"
      },
      {
        "language": "Deutsch",
        "locale": "de-de"
      }
    ]
  }
}

API reference

See Languages for further instructions.

Features

Get a list of features that support the English language

Use this example to access and list the camera’s unique features, all of which supports the English language.

1. Get a list of all the pre- and post installed features from the Camera that are available in the locale language English (en-us).

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "",
  "method": "features",
  "params": {
    "locale": "en-us",
    "acceptLocaleMismatch": false
  }
}

API reference

See Features for further instructions.

Get a list of features that support the Swedish language

Use this example to list features that supports the locale language “Svenska” (sv-sv). If there are no feature descriptions (default or added by user) available in Swedish, the response will contain an error. This means that the requested language should be one of the languages given in the response of Languages. If a feature is lacking a description in the requested language, the default (en-us) version for that feature will be included in the response.

1. Get a list of all the pre- and post installed features from the Camera that are available in the Swedish language.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "",
  "method": "features",
  "params": {
    "locale": "sv-sv",
    "acceptLocaleMismatch": false
  }
}
Response to a request with an unsupported locale
{
  "apiVersion": "1.0",
  "context": "",
  "method": "features",
  "error": {
    "errorCode": 2002,
    "errorMsg": "The given locale is not supported."
  }
}

API reference

See Features for further instructions.

Get features for a specific channel

Use this example to see the features for the currently active video channel.

1. Retrieve a list of the installed features from a device. This can be done on both devices where you have requested a channel ID and devices that doesn’t have a channel ID.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "",
  "method": "features",
  "params": {
    "channel": 1
  }
}

API reference

See Features for further instructions.

Add features

Use this example to add a new feature in the form of an application, intended to be used with the Video Management Software (VMS).

Add new features

1. Updates the features in the camera with the new feature descriptions.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "",
  "method": "addFeatures",
  "params": {
    "locale": "en-us",
    "language": "English",
    "featureDescription": {
      "name": "featureGroup_identifier",
      "niceName": "featureGroup niceName",
      "featureGroups": [],
      "features": [
        {
          "user": ["operator"],
          "name": "colorLevel",
          "niceName": "Color Level",
          "info": "Choose color level",
          "requestType": "GET",
          "requestURL": "/axis-cgi/param.cgi?action=update&root.ImageSource.I0.Sensor.ColorLevel={color}",
          "parameters": {}
        }
      ]
    }
  }
}

2. Response when new features are added to the camera.

{
  "apiVersion": "1.0",
  "context": "",
  "method": "addFeatures",
  "data": {}
}

API reference

See addFeatures for further instructions.

List added features

Use this example to list manually added features and their supported languages.

List manually installed features

1. List the added features from the camera.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "",
  "method": "listAddedFeatures",
  "params": {}
}

2. Response list added feature from the camera.

{
  "apiVersion": "1.0",
  "context": "",
  "method": "listAddedFeatures",
  "data": {
    "addedFeatures": [
      {
        "name": "featureGroup_identifier",
        "locales": [
          {
            "locale": "en-us",
            "language": "English"
          },
          {
            "locale": "de-de",
            "language": "Deutsch"
          },
          {
            "locale": "es-es",
            "language": "Espanol"
          }
        ]
      },
      {
        "name": "featureGroup_identifer_2",
        "locales": [
          {
            "locale": "de-de",
            "language": "Deutsch"
          }
        ]
      },
      {
        "name": "featureGroup_identifer_3",
        "locales": [
          {
            "locale": "es-es",
            "language": "Espanol"
          }
        ]
      }
    ]
  }
}

API reference

See listAddedFeatures for further instructions.

Remove features

Use this example to remove features from previously installed applications.

Remove manually installed features

1. Remove the feature information from the camera.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "removeFeatures",
  "params": {
    "locale": "en-us",
    "name": "featureGroup_identifier"
  }
}

2. Response features removed from the camera.

{
  "apiVersion": "1.0",
  "context": "",
  "method": "removeFeatures",
  "data": {}
}

API reference

See section removeFeatures for further instructions.

Get all features

Use this example to get all available descriptions in the supported languages with one CGI request.

Get a collection of all feature descriptions

1. Get a list of all feature descriptions.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.1",
  "context": "",
  "method": "getAllFeatures",
  "params": {}
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "1.1",
  "context": "",
  "method": "getAllFeatures",
  "data": {
    "en-us": {
      "name": "root",
      "niceName": "",
      "featureGroups": [{
        "name": "PTZ",
        "niceName": "PTZ",
        "featureGroups": [],
        "features": [{
          "user": [
            "operator"
          ],
          "name": "SpeedDry",
          "niceName": "Speed Dry",
          "info": "Remove water from the camera dome.",
          "requestType": "GET",
          "response": false,
          "requestURL": "/axis-cgi/com/ptz.cgi?auxiliary=speeddry"
        }]
      }],
      "features": []
    },
    "de-de": {
      "name": "root",
      "niceName": "",
      "featureGroups": [{
        "name": "PTZ",
        "niceName": "PTZ",
        "featureGroups": [],
        "features": [{
          "user": [
            "operator"
          ],
          "name": "SpeedDry",
          "niceName": "Speed Dry",
          "info": "Wasser aus der Kamera entfernen.",
          "requestType": "GET",
          "response": false,
          "requestURL": "/axis-cgi/com/ptz.cgi?auxiliary=speeddry"
        }]
      }],
      "features": []
    },
    "sv-sv": {
      "name": "root",
      "niceName": "",
      "featureGroups": [{
        "name": "PTZ",
        "niceName": "PTZ",
        "featureGroups": [],
        "features": [{
          "user": [
            "operator"
          ],
          "name": "SpeedDry",
          "niceName": "Speed Dry",
          "info": "Avlägsna vatten från kameran.",
          "requestType": "GET",
          "response": false,
          "requestURL": "/axis-cgi/com/ptz.cgi?auxiliary=speeddry"
        }]
      }],
      "features": []
    }
  }
}
Error response
{
  "apiVersion": "1.1",
  "context": "",
  "method": "getAllFeatures",
  "error": {
    "code": 9999,
    "message": "Internal error"
  }
}

API references

See section getAllFeatures for further instructions.

Get a collection of all feature descriptions including disabled features

1. Retrieve a list of all feature descriptions, including disabled features.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.1",
  "context": "",
  "method": "getAllFeatures",
  "params": {
    "showDisabled": true
  }
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "1.1",
  "context": "",
  "method": "getAllFeatures",
  "data": {
    "en-us": {
      "name": "root",
      "niceName": "",
      "featureGroups": [{
        "name": "PTZ",
        "niceName": "PTZ",
        "featureGroups": [],
        "features": [{
          "user": [
            "operator"
          ],
          "name": "SpeedDry",
          "niceName": "Speed Dry",
          "info": "Remove water from the camera dome.",
          "requestType": "GET",
          "response": false,
          "requestURL": "/axis-cgi/com/ptz.cgi?auxiliary=speeddry"
        }]
      }],
      "features": [],
      "status": "disabled"
    },
    "de-de": {
      "name": "root",
      "niceName": "",
      "featureGroups": [{
        "name": "PTZ",
        "niceName": "PTZ",
        "featureGroups": [],
        "features": [{
          "user": [
            "operator"
          ],
          "name": "SpeedDry",
          "niceName": "Speed Dry",
          "info": "Wasser aus der Kamera entfernen.",
          "requestType": "GET",
          "response": false,
          "requestURL": "axis-cgi/com/ptz.cgi?auxiliary=speeddry"
        }]
      }],
      "features": [],
      "status": "enabled"
    },
    "sv-sv": {
      "name": "root",
      "niceName": "",
      "featureGroups": [{
        "name": "PTZ",
        "niceName": "PTZ",
        "featureGroups": [],
        "features": [{
          "user": [
            "operator"
          ],
          "name": "SpeedDry",
          "niceName": "Speed Dry",
          "info": "Avlägsna vatten från kameran.",
          "requestType": "GET",
          "response": false,
          "requestURL": "/axis-cgi/com/ptz.cgi?auxiliary=speeddry"
        }]
      }],
      "features": [],
      "status": "disabled"
    }
  }
}
Error response
{
  "apiVersion": "1.1",
  "context": "",
  "method": "getAllFeatures",
  "error": {
    "code": 9999,
    "message": "Internal error"
  }
}

API references

See section getAllFeatures for further instructions.

Get supported versions

Use this example to check if the API version are supported before the application uses them.

1. Get a list of supported API versions.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "2.0",
  "context": "abc",
  "method": "getSupportedVersions"
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "2.0",
  "context": "abc",
  "method": "getSupportedVersions",
  "data": {
    "apiVersions": ["1.1", "2.0"]
  }
}
Error response
{
  "apiVersion": "2.0",
  "context": "abc",
  "method": "getSupportedVersions",
  "error": {
    "code": 9999,
    "message": "Internal error"
  }
}

API reference

See section getSupportedVersions for further instructions.

Enable and disable features

Use this example when you are implementing an application that uses On-screen controls and you want to use a method that can show or hide a feature from a user without having to remove it. The disabled feature does not appear in the response from a feature request.

Enable features

1. Show the option either enable or disable the feature in the API.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.3",
  "context": "",
  "method": "enableFeature",
  "params": {
    "name": "IR"
  }
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "1.3",
  "context": "",
  "method": "enableFeature",
  "data": {}
}
Error response
{
  "apiVersion": "1.3",
  "context": "",
  "method": "enableFeature",
  "error": {
    "code": 2005,
  "message": "Feature not found."
  }
}

API references

See enableFeature for further instructions.

Disable features

1. Remove the option to either enable or disable the feature in the API.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.3",
  "context": "",
  "method": "disableFeature",
  "params": {
    "name": "IR"
  }
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "1.3",
  "context": "",
  "method": "disableFeature",
  "data": {}
}
Error response
{
  "apiVersion": "1.3",
  "context": "",
  "method": "disableFeature",
  "error": {
    "code": 2005,
    "message": "Feature not found."
  }
}

API specification

See disableFeature for further instructions.

Use a feature that accepts audio data

Use this example to specify audio encoding for features that are able to take binary audio data as input.

1. Get a list of supported features.

http://myserver/local/axis-onscreencontrols/onscreencontrols.cgi
JSON input parameters
{
  "apiVersion": "1.4",
  "context": "",
  "method": "features",
  "params": {
    "locale": "en-us"
  }
}

2. Parse the JSON response.

Successful response
{
  "apiVersion": "1.4",
  "context": "",
  "method": "features",
  "data": {
    "featureDescription": {
      "name": "root",
      "niceName": "",
      "featureGroups": [
        {
          "name": "transmitAudio",
          "niceName": "Play audio",
          "featureGroups": [],
          "features": [
            {
              "user": ["operator"],
              "name": "transmitAudio",
              "niceName": "Play audio",
              "info": "Play audio",
              "requestType": "POST",
              "requestPayload": "BINARY",
              "response": false,
              "requestURL": "/axis-cgi/audio/transmit.cgi",
              "parameters": {
                "audio": {
                  "type": "transmitAudioData",
                  "contentType": [
                    "g711",
                    "g726",
                    "axis-mulaw-128"
                  ]
                }
              }
            }
          ],
          "status": "enabled"
        }
      ],
      "features": []
    }
  }
}

API reference

See Features for further instructions.

API specification

OnscreenControls CGI

The API consists of a single CGI, namely onscreencontrols.cgi, that takes JSON formatted data which specifies the method.

Request

Security level

Viewer

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "Major.Minor",
  "context": "context-id",
  "method": "method-id",
  "params": {}
}
CGI input parameters table
ParameterTypeDescription
apiVersionStringThe requested API version in the format Major.Minor.
contextStringOptional context string. Client sets this value and the application echoes it back in the response.
methodStringThe operation to perform.
paramsJSON objectContainer for method parameters.
Note: This is required for some methods and optional for others. See respective method description for info.

Return value

HTTP code

200 OK

Content-type

application/json

Successful response
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request.",
  "method": "method-id",
  "data": {}
}
Error response
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request.",
  "method": "method-id",
  "error": {
    "code": errorCode,
    "message": "A description of the error."
  }
}
CGI output parameters table
ParameterTypeDescription
apiVersionStringThe requested API version in the format Major.Minor.
contextStringEchoed if provided by the client in the corresponding request.
methodStringThe operation that was performed.
dataJSON objectPresent if a request was successfully performed. Container for method output data.
errorJSON objectPresent if a request could not be performed. Container for error information.

Methods

Possible values of method for onscreencontrols.cgi.

Languages

Returns a list supported languages and locales.

apiVersion

1.0

Request

Security level

Viewer

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "languages",
  "params": {}
}
CGI input parameters table
ParameterTypeRequirement
apiVersionStringRequired
contextStringOptional
methodStringRequired
paramsJSON objectRedundant. This method does not support any input parameters.

Return value

If the result is successful, the method returns a list with supported languages and locales.

If the result is an error, the method returns an error code and a corresponding error message.

HTTP code

200 OK

Content-type

application/json

Successful response
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request",
  "method": "languages",
  "data": {
    "languages": [
      {"language": "English", "locale": "en-us"},
      {"language": "Deutsch", "locale": "de-de"},
      {"language": "Svenska", "locale": "sv-sv"}
    ]
  }
}
Error response
{
  "apiVersion": "1.0",
  "context": "Echoed if provided in the corresponding request",
  "method": "languages",
  "error": {
    "code": errorCode,
    "message": "This thing went wrong."
  }
}
Language output parameters table
ParameterTypeDescription
dataJSON objectPresent if request was performed successfully. Container for method output data. The content is described in Language output data below.
errorJSON objectPresent if request could not be performed. Container for error information. The content is described in Error return values below.
Language output data
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request",
  "method": "languages",
  "data": {
    "languages": [
      {"language": "English", "locale": "en-us"},
      {"language": "Deutsch", "locale": "de-de"},
      {"language": "Svenska", "locale": "sv-sv"}
    ]
  }
}

The parameter data in the response is a JSON object that will contain one JSON array with the identifier languages. This array contains JSON objects that specify the languages, and their respective locales, in which available features can be described. The locales are used as inputs in Features.

Error return values

Error content for languages
ParameterTypeDescription
codeIntegerAn error code, see Error codes.
messageStringA text describing the error.

Features

Returns a collection of available features.

apiVersion

1.0

Request

Security level

Viewer

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "features",
  "params": {
    "locale": "en-us",
    "acceptLocaleMismatch": true
  }
}
CGI input parameters
ParameterTypeRequirement
apiVersionStringRequired
contextStringOptional
methodStringRequired
paramsJSON objectOptional. See the Feature data parameters table below for default values.
Feature data parameters
ParameterTypeDescription
localeStringA locale specifier (e.g. en-us) which determines the language of the returned information. Must be one of the supported locales obtained with Languages. Defaults to “en-us” if not specified.
acceptLocaleMismatchBooleanIf set to true, feature information that is not available in the given locale or in English will be included in the response in the first found language. Otherwise it will be ignored. Defaults to false.
channelIntegerA channel/source specifier that filters the returning information. If set, the default returned information will contain both the features with the chosen channel ID and the features without a channel ID.

Return value

If the result is successful, the method returns a collection of available features.

If the result is an error, the method returns an error code and a corresponding error message.

HTTP code

200 OK

Content-type

application/json

Successful response
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "features",
  "data": {
    "featureDescription": {
    "name": "root",
    "niceName": "",
    "featureGroups": [],
      "features": []
    }
  }
}
Error response
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request",
  "method": "features",
  "error": {
    "code": errorCode,
    "message": "Could not return any features."
  }
}
Feature output parameters
ParameterTypeDescription
dataJSON objectPresent if request was performed successfully. Container for method output data. The content is described in Description of fields in featureGroups structure.
errorJSON objectPresent if request could not be performed. Container for error information. The content is described in Error return values below.

Error return values

Error content for features
ParameterTypeDescription
codeIntegerAn error code, see Error codes.
messageStringA text describing the error.

addFeatures

Add information about a manually installed feature.

apiVersion

1.0

Request

Security level

Admin

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "addFeatures",
  "params": {}
}
CGI input parameters
ParameterTypeRequirement
apiVersionStringRequired
contextStringOptional
methodStringRequired
paramsJSON objectRequired, see the addFeatures data parameters table below.
addFeatures data parameters
ParameterTypeDescription
localeStringMust be formatted in on of two ways, ab or ab-xy.
languageStringName of the language.
featureDescriptionJSON ObjectSee Description of fields in feature structures for description of this parameter.
JSON example for the addFeatures CGI method
{
  "apiVersion": "1.0",
  "context": "",
  "method": "addFeatures",
  "params": {
    "locale": "en-us",
    "language": "English",
    "featureDescription": {
      "name": "featureGroup_identifier",
      "niceName": "featureGroup niceName",
      "featureGroups": [],
      "features": [
        {
          "user": ["operator"],
          "name": "colorLevel",
          "niceName": "Color Level",
          "info": "Choose color level",
          "requestType": "GET",
          "requestURL": "/axis-cgi/param.cgi?action=update&root.ImageSource.I0.Sensor.ColorLevel={color}",
          "parameters": {}
        }
      ]
    }
  }
}

Return value

If the result is successful, the method saves the new feature descriptions.

If the result is an error, the method returns an error code and a corresponding error message.

HTTP code

200 OK

Content-type

application/json

Successful response
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "addFeatures",
  "data": {}
}
Error response
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request",
  "method": "addFeatures",
  "error": {
    "code": errorCode,
    "message": "Could not save the feature description."
  }
}
addFeatures output parameters
ParameterTypeDescription
dataJSON objectPresent but empty if the request was successfully performed.
errorJSON objectPresent if the request could not be performed. Container for error information. The content is described in Error return values below.

Error return values

Error content for features
ParameterTypeDescription
codeIntegerAn error code, see Error codes.
messageStringA text describing the error.

listAddedFeatures

Lists the feature descriptions added by the user.

apiVersion

1.0

Request

Security level

Admin

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.0",
  "context": "",
  "method": "listAddedFeatures",
  "params": {}
}
CGI input parameters table
ParameterTypeRequirement
apiVersionStringRequired.
contextStringOptional.
methodStringRequired.
paramsJSON objectRedundant. This method does not take any input parameters.

Return value

If the result is successful, the method returns the list of manually added features. For descriptions and APIs, see Features.

If the result is an error, the method returns an error code and a corresponding error message.

HTTP code

200 OK

Content-type

application/json

Successful response
{
  "apiVersion": "1.0",
  "context": "",
  "method": "listAddedFeatures",
  "data": {
    "addedFeatures": [
      {
        "name": "featureGroup_identifier",
        "locales": [
          {
            "locale": "en-us",
            "language": "English"
          },
          {
            "locale": "de-de",
            "language": "Deutsch"
          },
          {
            "locale": "es-es",
            "language": "Espanol"
          }
        ]
      },
      {
        "name": "featureGroup_identifier_2",
        "locales": [
          {
            "locale": "de-de",
            "langauge": "Deutsch"
          }
        ]
      },
      {
        "name": "featureGroup_identifier_3",
        "locales": [
          {
            "locale": "es-es",
            "language": "Espanol"
          }
        ]
      }
    ]
  }
}
listAddedFeatures output parameters
ParameterTypeDescription
dataJSON objectPresent but empty if the request was successfully performed.
errorJSON objectPresent if the request could not be performed. Container for error information. The content is described in the table Error content for listAddedFeatures below.

Error return values

Error content for listAddedFeatures
ParameterTypeDescription
codeIntegerAn error code, see Error codes.
messageIntegerA text describing the error.

removeFeatures

Remove information that has been added about a manually installed feature.

apiVersion

1.0

Request

Security level

Admin

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "removeFeatures",
  "params": {}
}
CGI input parameters
ParameterTypeRequirement
apiVersionStringRequired.
contextStringOptional.
methodStringRequired.
paramsJSON objectRequired. See the removeFeatures input parameters table below.
removeFeatures input parameters
ParameterTypeDescription
localeStringRequired. Specifies the locale for which the featureGroup should be removed.
nameStringRequired. Specifies the featureGroup to remove.
JSON example for the removeFeatures CGI method
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "removeFeatures",
  "params": {
    "locale": "en-us",
    "name": "featureGroup_identifier"
  }
}

Return value

If the result is successful, the method removes the feature descriptions.

If the result is an error, the method returns an error code and a corresponding error message.

HTTP code

200 OK

Content-type

application/json

Successful response
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "removeFeatures",
  "data": {}
}
Error response
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided in the corresponding request",
  "method": "addFeatures",
  "error": {
    "code": errorCode,
    "message": "Could not remove feature description."
  }
}
removeFeatures output parameters
ParameterTypeDescription
dataJSON objectPresent but empty if the requested was successfully performed.
errorJSON objectPresent if the request could not be performed. Container for error information. The content is described in Error return values below.

Error return values

Error content for features
ParameterTypeDescription
codeIntegerAn error code, see Error codes.
messageStringA text describing the error.

getAllFeatures

A CGI method for retrieving all feature descriptions in all available languages. The returned collection contains all feature descriptions arranged in JSON objects identical with Features, using locales as keys. The locales are the same as returned by Languages.

apiVersion

1.1

Request

Security level

Viewer

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.1",
  "context": "context-id",
  "method": "getAllFeatures",
  "params": {}
}

The following table lists the JSON parameters for this CGI method.

getAllFeatures data parameters
ParameterTypeRequirement
apiVersionStringRequired.
contextStringOptional.
methodStringRequired.
paramsJSON ObjectRedundant. This method does not take any input parameters.

Return value

HTTP code

200 OK

Content-type

application/json

{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided by the client in the corresponding request",
  "method": "getAllFeatures",
  "data": {
    "en-us": {
      "name": "root",
      "niceName": "",
      "featureGroups": [...],
      "features": []
    }
    "de-de": {
      "name": "root",
      "niceName": "",
      "featureGroups": [...],
      "features": []
    }
    "sv-sv": {
      "name": "root",
      "niceName": "",
      "featureGroups": [...],
      "features": []
    },
    ...
  }
}

getSupportedVersions

A CGI method for retrieving the supported API versions. The returned list consists of the supported major versions, with highest supported minor versions. Note that the version is for the API as a whole, i.e. for all methods in the CGI.

apiVersion

1.0

Request

Security level

Viewer

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.0",
  "context": "context-id",
  "method": "getSupportedVersions",
  "params": {}
}

The following table lists the JSON parameters for this CGI method.

getSupportedVersions data parameters
ParameterTypeRequirements
apiVersionStringRequired.
contextStringOptional.
methodStringRequired.
paramsJSON ObjectRedundant. This method does not take any input parameters.

Return value

HTTP code

200 OK

Content-type

application/json

Response body syntax
{
  "apiVersion": "Major.Minor",
  "context": "Echoed if provided by the client in the corresponding request",
  "method": "getSupportedVersions",
  "data": {
    "apiVersions": ["<Major1>.<Minor1>", "<Major2>.<Minor2>"]
  }
}

enableFeature

This CGI method can be used to change the status of a feature to enabled.

apiVersion

1.3

Request

Security level

Admin

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.3",
  "context": "context-id",
  "method": "enableFeature",
  "params": {
    "name": "feature-name"
  }
}
ParameterTypeRequirement
apiVersionStringRequired.
contextStringOptional.
methodStringRequired.
paramsJSON objectRequired.
ParameterTypeDescription
nameStringRequired. Specifies the name of the feature that should be enabled.

Return value

HTTP code

200 OK

Content-type

application/json

Response body syntax
{
  "apiVersion": "Major.Minor",
  "context": "",
  "method": "enableFeature",
  "data": {}
}

disableFeature

This CGI method is used to change the status of a feature to disabled.

apiVersion

1.3

Request

Security level

Admin

Method

POST

http://<myserver>/local/axis-onscreencontrols/onscreencontrols.cgi
Request body syntax
{
  "apiVersion": "1.3",
  "context": "context-id",
  "method": "disableFeature",
  "params": {
    "name": "feature-name"
  }
}
ParameterTypeRequirement
apiVersionStringRequired.
contextStringOptional.
methodStringRequired.
paramsJSON objectRequired.
ParameterTypeDescription
nameStringRequired. Specifies the name of the feature that should be disabled.

Return value

HTTP code

200 OK

Content-type

application/json

Response body syntax
{
  "apiVersion": "Major.Minor",
  "context": "",
  "method": "disableFeature",
  "data": {}
}

Error codes

CodeDescription
1001Out of memory.
1002Error in the CGI request.
1003CGI request is an invalid method.
2001Error in the database.
2002Invalid locale.
2003Invalid JSON.
2004Unsupported API version.
2005Missing data param.
9999Internal error.

Parameters

Description of fields in featureGroups structure

Fields in featureGroups structure table
ParameterTypeDescription
nameStringName of a feature in English, used as an identifier.
niceNameStringTranslated name of the featureGroup according to the requested locale.
featureGroupsArray [JSON Object]An array of featureGroups, used for grouping features together like PTZ features or similar. Features added with addFeatures will be placed in a post install group, and then an individual group for the specific request.
featuresArray [JSON Object]An array of features that are located in this featureGroup, see Description of fields in feature structures.

Description of fields in feature structures

Fields in feature structure table
ParameterTypeDescription
nameStringName of a feature in English and used as an identifier.
niceNameStringTranslated name of a feature according to the requested locale.
userArray [String]Recommended user level for accessing this feature. Valid values are operator, admin and event.
infoStringTranslated information string about the feature.
requestTypeStringHow the CGI request should be sent to a camera. Valid values are GET and POST.
requestPayloadStringSpecify the format of the request payload. Valid values are JSON and BINARY. Reserved for future use is SOAP and XML.
requestURLStringURL to trigger the feature param, which should be replaced by parameter values. See table Fields in requestURL parameter structure below.
responseBooleanIf the request will return a value to the VMS. See Description of fields in requestURL response structures.
vmsHintArray [Strings]vmsHint specifies the client side actions that is suitable to do when a button is pressed. These are not mandatory. See the Valid values for vmsHint parameter table below.
vmsReqArray [Strings]vmsReq specifies a requirement to the VMS that needs to be fulfilled for the button to be useful for a user. If these Requirements are not fulfilled, ignore this button. See table Valid values for vmsReq parameter below.
jsonTemplateStringUsed as a template for the json payload of a POST request, this field is only present when requestPayload is JSON. The String that shows how a Json Request should be formatted. The template string could for example look like this: "{1,2,3,4:[4,5],6}" or "{1}", "{1,2,3,4:{5}}". 1,2,3,4.. is the name of the parameters in the JSON Object.
parametersJSON ObjectDescription of parameters to use in requestURL. See table Fields in requestURL parameter structure below.
Fields in the requestURL parameter structure
ParameterTypeDescription
typeStringType of parameters to be used in the URL. For valid values, see tables Range specific fields in parameter object, Geometric types, Specific field in string parameter object, Specific fields in a multiOption parameter object, Specific field in json only parameter type and transmitAudioData types below.
niceNameStringShort description (one or two words) of the parameter.
infoStringOptional information about the parameter.
KeyStringString to use as a key for parameters in a JSON Payload.
jsonVariableFormatStringWhich format for the JSON parameters to use. For valid values, see table Valid values for jsonVariableFormat parameter.
Range specific fields in parameter object
ParameterTypeDescription
defaultValueStringDefault value for range.
unitStringType of value to be used in a range. Valid values are integer, fraction.
minStringMinimum value for range.
maxStringMaximum value for range.
stepStringStepsize for range.

There is a number of parameter types that interacts with position on the video feed. This position should be collected with a mouse pointer or similar. All coordinates are normalized. A parameter that uses coordinates have a type and a niceName.

Geometric types
TypeDescription
coordinateSpecify the normalized coordinates on the form [X,Y]. The [0.0,0.0] is the top left corner of the image frame [1.0,1.0] is the bottom right corner.
lineTwo normalized coordinate pairs that forms a line. Given in the format [X1,Y1,X2,Y2], where X1,Y1 is the first point in a line draw by an operator.
boxTwo normalized coordinate pairs that forms a box. Given in the format [X1,Y1,X2,Y2], where X1,Y1 is the top left corner of the box and X2,Y2 is the bottom right corner of the box.
polygonA number of normalized coordinate pairs that creates a closed shape. Given in the format [X1,Y1,X2,Y2,. . . ,Xn,Yn], where Xn,Yn is the point that connects back to X1,Y1.
niceNameName of the coordinate, line . . . translated to the user language. For example, a Polygon could have a niceName "Motion Detection Area".
Specific field in a string parameter object
ParameterTypeDescription
defaultValueStringDefault value of a string that suggests user as input. Any string, including empty, is valid.
Specific fields in a multiOption parameter object
ParameterTypeDescription
defaultValueStringDefault value for multiOption (Value, not the translated niceName).
valuesArray [JSON Object]List of possible values for a multiOption parameter. Each object contains a value and a niceName. See table Specific fields in a multiOption values parameter object below.
Specific fields in a multiOption values parameter object
ParameterTypeDescription
valueStringValue that should be part of requestURL for multiOption parameters.
niceNameStringTranslated name for multiOption parameters.

There exist a number of parameter types that is only used when the target CGI requires a JSON payload.

Specific field in json only parameter type
TypeDescription
fixedThe string in "value" should be used as the value in the key:value json pair.
contextThe value in the value field in the key:value pair will be returned by the camera.
keyOnlyUsed when only a key is needed, for example as the header for JSON objects and lists.
transmitAudioData types
ParameterTypeDescription
contentTypeStringAudio content type that should be used when you want to transmit data. Valid values are:
  • g711

  • g726

  • axis-mulaw-128

This table shows how to format the value part of a JSON parameter.

Valid values for the jsonVariableFormat parameter
TypeDescription
stringThe key:value pair should be formatted to read “key”:”variable string”.
integerThe key:value pair should be formatted to read “key”:5 or “key”-5.
fractionThe key:value pair should be formatted to read “key”: 5.0 or “key”:–5.0.
exponentThe key:value pair should be formatted to read “key”:5.0e+2 or “key”:-5.0e-3.
booleanThe key:value pair should be formatted to read “key”:true or “key”: false.
nullThe key:value pair should be formatted to read “key”:null.
Valid values for the vmsHint parameter
HintDescription
windowCloseIf the camera appears in a popup window, this command will close the window.
audioOutDisableMute the operator microphone. This command is usually used as a mute button for cameras with audio communication devices.
audioOutEnableOpen the operator microphone to the camera. This command is usually used as an unmute button for cameras with audio communication devices.
audioOutToggleToggle the operator microphone between a mute and an unmute state.
audioInDisableMute the camera microphone. This command is usually used as a mute button for cameras with audio communication devices.
audioInEnableStart listening on the microphone for the camera.
audioInToggleToggle the camera microphone between a mute and an unmute state.
hiddenThese features are of lower importance and could be hidden from the operator. An example is trigger virtual input 20.
Valid values for the vmsReq parameter
ReqDescription
eventStreamThis button produces an event in the Dynamic Event Stream. The VMS needs to be able to understand these events to have any benefit of this button.

Description of fields in requestURL response structures

Fields in the requestURL response structure
ParameterTypeDescription
vmsHintArray [String]What the VMS should do with the return value. The valid value is display, store as shown in the table Valid values for vmsHint in response below.
contextStringVariable containing the context value from the request.
typeStringType of response. Can be either in the form of an integer, string, boolean, array, object.
valueDefined by typeReturn value from Request.
Valid values for vmsHint in response
ValueDescription
displayThe returned value should be displayed to the user.
storeStore the returned value as a searchable metadata.
Example: requestURL response structure
{
  "vmsHint": "display",
  "type": "string",
  "value": "Hi!"
}