Counters

Returns counters information.

Request

DCM_API_DOMAIN will be provided by DCM.

URL: <DCM_API_DOMAIN>/counters

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-counter.

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.

Counters

Query Structure

query {
    counters(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

string

Yes

 

The ID of the project from where the counters will be retrieved.

data_fields_to_be_retrieved

string

Yes


The fields to be retrieved.

Allowed values:

  • projectId = Project ID

  • deploymentId = Deployment ID

  • counterId = Counter ID

  • name = Counter Name

  • isActive = Counter’s Active Flag (True/False)

  • firstDate = First date of the detection

  • lastDate = Last date of the detection

Notes:

  • Rate limit: 1 request per minute

Response

Format: application/json

Values:

Name

Type

Description

errors.message

String

Description of the error if one occurred.

data.counters

List

List of counters.

Example

Request:

Python
query {
    counters(projectId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") {
        projectId
        deploymentId
        counterId
        name
        isActive
        firstDate
        lastDate
    }
}

Response:

JSON
{
    "data": {
        "counters": [
            {
                "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                "deploymentId": "xxxxxxxxxx",
                "counterId": "xxxxxxxxxx",
                "name": "Calibration 1",
                "isActive": true,
                "firstDate": "2021-04-08T00:58:13.428Z",
                "lastDate": "2021-04-12T13:30:17.740Z"
            }
        ]
    }
}

Count

Query Structure:

query {
    count(counterId: <counter_id>,
          startDateTime: <start_date_time>,
          endDateTime: <end_date_time>,
          timezone: "Australia/Sydney"
        )
        <data_fields_to_be_retrieved>
    }
}

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

Parameter

Type

Mandatory

Default Value

Description

counter_id

Integer

Yes


The ID of the counter (camera view) that data is required for. The list of valid counters can be retrieved using the “Counters” endpoint.

start_time

DateTime

No

Now - 1 hour

The start date and time of the period data is requested for. Time periods are in UTC format and can be a maximum of a 24 hour period.

end_time

DateTime

No

Now

The end date and time of the period data is requested for.

timezone

String

No

Etc/UTC

The timezone name for parameters and data (IANA timezone database specification). See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for the list of timezone names.

e.g.

“Australia/Sydney”

“Europe/London”

data_fields_to_be_retrieved

string

Yes

 

The fields to be retrieved.

Allowed values:

  • projectId = Project ID

  • deploymentId = Deployment ID

  • counterId = Counter ID

  • name = Counter Name

  • in = Total IN count

  • out = Total OUT count

Notes:

  • Rate limit: 1 request per minute

  • If end_time is more than 1 day after start_time an error will occur and no data will be retrieved.

Response

Format: application/json

Values:

Name

Type

Description

errors.message

String

Description of the error if one occurred.

data.count

Object

Counter information with in and out totals.

Example

Request:

Python
query {
    count(counterId: "xxxxxxxxxx",
          startDateTime: "2022-06-29T01:49:11.534Z",
          endDateTime: "2022-06-30T01:49:11.534Z",
          timezone: "Australia/Sydney"
        ) {
        projectId
        deploymentId
        counterId
        name
        in
        out
    }
}

Response:

JSON
{
    "data": {
        "count": {
            "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            "deploymentId": "xxxxxxxxxx",
            "counterId": "xxxxxxxxxx",
            "name": "Calibration 3",
            "in": 1844,
            "out": 30233
        }
    }
}