Calibrations

Retrieves list of calibrations. DCM_API_DOMAIN will be provided by DCM.

Request

URL: <DCM_API_DOMAIN>/calibrations

Method: POST

Format: application/json

Headers: The following headers must be included in the request

Parameter

Type

Mandatory

Description

content-type

string

Yes

Indicates the media type of the resource. Use application/json.

authorization Token

string

Yes

Token to be used when accessing the API. Value is Bearer <token>.

Use token from Token. audience is ext-api-calibration.

Parameters:

Parameter

Type

Mandatory

Default Value

Description

query

string

Yes

 

A structured string that allows calling application to specify the data that it wants to retrieve.

Query structure:

query {
    calibrations(projectId: <project_id>) {
        <data_fields_to_be_retrieved>
    }
}

Query Parameters: The following are parameters to be included in the request.

Parameter

Type

Mandatory

Default Value

Description

project_id

Integer

No


The Id of the project that data is required for. If no project is specified, all calibrations for all projects the user has access to is returned.

data_fields_to_be_retrieved

string

Yes

 

The fields to be retrieved.

Allowed values:

  • projectId

  • calibrationId

  • name

  • ptzLockedOut

  • lastDensityData

Response

Format: application/json

Parameters:

Name

Type

Description

errors.message

String

Description of the error if one occurred.

data.calibrations

List

List of calibrations.

Notes:

  • lastDensityData will return null if no data in last 30 days.

  • ptzLockedOut will be “NA” for non-PTZ cameras

Examples

  1. Retrieve all calibration fields

const getCalibrations = async function(token, projectId) {
    return new Promise(function(res, rej) {
        const url =  '<DCM_API_DOMAIN>/calibrations';
        const method = 'POST';
        const headers = { 
            'content-type': 'application/json',
            'authorizationToken': `Bearer ${token}`
        };
        const query = `query {
            calibrations(projectId: "${projectId}") {
                projectId
                calibrationId
                name
                ptzLockedOut
                lastDensityData
            }
        }`;
        const options = {
            url: url,
            method: method,
            headers: headers,
            body: JSON.stringify({ query })
        };

        const req = request(options, function callback(error, response, body) {
            body = JSON.parse(body);
            ...
            ...
        });
    });
}

Response

{
  "data": {
    "calibrations": [
      {
        "projectId": "<project_id>",
        "calibrationId": "<calibration_id>",
        "name": "<calibration_name>",
        "ptzLockedOut": "<Yes|No|NA>",
        "lastDensityData": "<null|YYYY-MM-DDThh:mm:ss.sssZ>"
      }
    ]
  }
}