Skip to main content

PTZ Orientation Aid API

Description

The PTZ Orientation Aid API allows an administrator to add a compass as an overlay to the video. This makes it easier for the operator to provide relevant information to other personnel, for instance "The burglar is running west on Main Street".

Identification

  • API Discovery: id=ptz-orientationaid

Authorization

  • DigestAuth: Admin, Operator
  • BasicAuth: Admin, Operator

Use cases

Set north direction

Use the setNorth method to set the direction that the camera is pointing to as north.

Get compass state

Use the getCompassState method to get the compass state.

Set compass state

  1. Use the getCompassState method to to get the compass state.
  2. Use the setCompassState method to to set the compass state.

List tags

Use the listTags method to get a list of all available tags.

Show or hide the tags for the preset positions

  1. Use the listTags method to get a list of all available tags.
  2. Use the setTagState method to show or hide the preset positions in the device web interface.

API specifications

setNorth

Use this method to set the direction that the camera is pointing to as north. You need to set it again whenever the camera position changes.

Request

curl --request POST \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/axis-cgi/ptz-orientationaid.cgi" \
--data '{
"apiVersion": "2.0",
"context": "example",
"method": "setNorth"
}'
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that should be used.

Response - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "setNorth",
"data": {}
}
ParametersTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that was performed.
dataObjectContains response specific parameters.

Response - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "setNorth",
"error": {
"code": 2003,
"message": "The requested API version is not supported."
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe performed method.
errorObjectThe error object.
error.codeIntegerThe error code.
error.messageStringThe error message for the corresponding error code.

Error codes

See General error codes for a list of potential errors.

getCompassState

Use this method to check if compass has been enabled.

Request

curl --request POST \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/axis-cgi/ptz-orientationaid.cgi" \
--data '{
"apiVersion": "2.0",
"context": "example",
"method": "getCompassState"
}'
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that should be used.

Response - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "getCompassState",
"data": {
"enabled": true
}
}
ParametersTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that was performed.
dataObjectContains response specific parameters.
data.enabledBooleanIndicates if compass is enabled.

Response - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "getCompassState",
"error": {
"code": 2003,
"message": "The requested API version is not supported."
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe performed method.
errorObjectThe error object.
error.codeIntegerThe error code.
error.messageStringThe error message for the corresponding error code.

Error codes

See General error codes for a list of potential errors.

setCompassState

Use this method to enable compass.

Request

curl --request POST \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/axis-cgi/ptz-orientationaid.cgi" \
--data '{
"apiVersion": "2.0",
"context": "example",
"method": "setCompassState",
"params": {
"enabled": true
}
}
~~~

| Parameter | Type | Description |
| --- | --- | --- |
| `apiVersion` | String | The API version that was used. |
| `context` | String | The context that was used when the request was made (optional). |
| `method` | String | The method that should be used. |
| `params` | Object | Contains method specific parameters. |
| `params.enable` | Boolean | States if the compass should be enabled. `true` = enabled or `false` = disabled. |

**Response - Success**

- **HTTP Code**: `200 OK`
- **Content-Type**: `application/json`

```json
{
"apiVersion": "2.0",
"context": "example",
"method": "setCompassState",
"data": {}
}'
ParametersTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that was performed.
dataObjectContains response specific parameters.

Response - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "setCompassState",
"error": {
"code": 2003,
"message": "The requested API version is not supported."
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe performed method.
errorObjectThe error object.
error.codeIntegerThe error code.
error.messageStringThe error message for the corresponding error code.

Error codes

See General error codes for a list of potential errors.

listTags

Use this method to list all available tags for the preset positions.

Request

curl --request POST \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/axis-cgi/ptz-orientationaid.cgi" \
--data '{
"apiVersion": "2.0",
"context": "example",
"method": "listTags"
}'
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that should be used.

Response - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "listTags",
"data": {
"id": "id",
"text": "text",
"display": true
}
}
ParametersTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that was performed.
dataObjectContains response specific parameters.
data.idStringThe ID of the preset position.
data.textStringThe name of the preset position.
data.displayBooleanIndicates whether the preset position is displayed in the device web interface.

Response - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "listTags",
"error": {
"code": 2003,
"message": "The requested API version is not supported."
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe performed method.
errorObjectThe error object.
error.codeIntegerThe error code.
error.messageStringThe error message for the corresponding error code.

Error codes

See General error codes for a list of potential errors.

setTagState

Use this method to show the tags for preset positions or not.

Request

curl --request POST \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/axis-cgi/ptz-orientationaid.cgi" \
--data '{
"apiVersion": "2.0",
"context": "example",
"method": "setTagState",
"params": {
"tagList": [
{
"id": "id",
"display": true
}
]
}
}'
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that should be used.
paramsObjectContains method specific parameters.
params.tagListArrayContainer for the tag list.
params.tagList.idStringThe ID of the preset position.
params.tagList.displayBooleanIndicates whether the preset position is displayed in the device web interface.

Response - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "setTagState",
"data": {}
}
ParametersTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that was performed.
dataObjectContains response specific parameters.

Response - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "setTagState",
"error": {
"code": 2003,
"message": "The requested API version is not supported."
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe performed method.
errorObjectThe error object.
error.codeIntegerThe error code.
error.messageStringThe error message for the corresponding error code.

Error codes

See General error codes for a list of potential errors.

getSupportedVersions

Use this method to get a list of API versions supported by your device.

Request

curl --request POST \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/axis-cgi/ptz-orientationaid.cgi" \
--data '{
"apiVersion": "2.0",
"context": "example",
"method": "getSupportedVersions"
}'
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that should be used.

Response - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "getSupportedVersions",
"data": {
"apiVersions": ["1.0", "2.0"]
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe method that should be used.
dataObjectContains response specific parameters.
data.apiVersionsArrayA list containing all supported major versions along with their highest minor version, e.g. ["1.0", "1.2"].

Return value - Failure

  • HTTP Code: 200 OK
  • Content-Type: application/json
{
"apiVersion": "2.0",
"context": "example",
"method": "getSupportedVersions",
"error": {
"code": 2003,
"message": "The requested API version is not supported."
}
}
ParameterTypeDescription
apiVersionStringThe API version that was used.
contextStringThe context that was used when the request was made (optional).
methodStringThe performed method.
errorObjectThe error object.
error.codeIntegerThe error code.
error.messageStringThe error message for the corresponding error code.

Error codes

See General error codes for a list of potential errors.

General error codes

This table lists the general error codes that can occur for any API method. Method specific errors are listed under the respective descriptions.

CodeDescription
1000Invalid parameter value.
2003The requested API version is not supported.
2004Method not supported.
4000The provided JSON input was invalid.
4001A mandatory input parameter was not found in the input.
4002The type of a provided JSON parameter was incorrect.
8000Internal error, could not complete the request.
8002Generic Error.