Skip to main content

P8815-2 3D people counter API

Description

The AXIS 3D People Counter API contains the information and steps that makes it possible to access and integrate people counting data with the AXIS P8815–2. Features include being able to keep count of the number of people in indoor premises, such as shopping centers.

Using the API also lets you use several different reporting capabilities to enable integration of the people counting data collected by your device into third-party services and applications.

API specification

Download foot traffic statistics

This method should be used when you want to retrieve the foot traffic statistics (In/Out) stored on your Axis camera using either JSON or plain text in a comma separated format (CSV).

  • Format: CSV or JSON
  • Method: GET

Request (CSV)

http://<servername>/a3dpc/api/export/csv?start=<date>&end=<date>&resolution=<resolution>

Request (JSON)

http://<servername>/a3dpc/api/export/json?start=<date>&end=<date>&resolution=<resolution>
FieldParameters
dateYYYYMMDD (start-of-day)
yesterday (start-of-day)
today (start-of-day)
now (current time)
resolutionminute
hour
day

Return

  • Successful response: HTTP code 200 OK

Returns the foot traffic statistics stored on the camera as either JSON or in plain text using the comma separated format (CSV). The first line in the CSV file contains a description of each element, while the following lines contain the corresponding data for the chosen time interval and its resolution: start, end, in, out.

  • Error response: HTTP code 400 Bad Request
{
"error": {
"message": "Validation failed",
"error": [
{
"field": "<field>",
"reason": "<reason>"
}
]
}
}

Example 1

This example will show you what happens when you retrieve foot traffic statistics from your camera using the JSON format. The data in this example will be from a previous day and measured in hourly intervals.

http://<servername>/a3dpc/api/export/json?start=yesterday&end=today&resolution=hour

Sample output

{
"data": [
{
"start": "2020-06-23 00:00:00",
"end": "2020-06-23 01:00:00",
"in": 0,
"out": 0
}
]
}

Example 2

This example will show you what happens when you retrieve the foot traffic statistics from your camera using the CSV format. The data in this example will be for the current day and measured in minute intervals.

http://<servername>/a3dpc/api/export/csv?start=today&end=now&resolution=minute

Sample output (first 10 lines)

start,end,in,out
2020-09-23 00:00:00,2020-09-23 00:01:00,0,0
2020-09-23 00:01:00,2020-09-23 00:02:00,0,0
2020-09-23 00:02:00,2020-09-23 00:03:00,0,0
2020-09-23 00:03:00,2020-09-23 00:04:00,0,0
2020-09-23 00:04:00,2020-09-23 00:05:00,0,0
2020-09-23 00:05:00,2020-09-23 00:06:00,0,0
2020-09-23 00:06:00,2020-09-23 00:07:00,0,0
2020-09-23 00:07:00,2020-09-23 00:08:00,0,0
2020-09-23 00:08:00,2020-09-23 00:09:00,0,0

Example 3

This example will show you what happens when you retrieve foot traffic statistics on your camera using the CSV format for a specific date range. The data in this example will be between 2020–08–01 and up until today, measured in daily intervals.

http://<servername>/a3dpc/api/export/csv?start=20200801&end=today&resolution=day

Sample output (first 10 lines)

start,end,in,out
2020-08-01 00:00:00,2020-08-02 00:00:00,0,0
2020-08-02 00:00:00,2020-08-03 00:00:00,0,0
2020-08-03 00:00:00,2020-08-04 00:00:00,0,0
2020-08-04 00:00:00,2020-08-05 00:00:00,0,0
2020-08-05 00:00:00,2020-08-06 00:00:00,0,0
2020-08-06 00:00:00,2020-08-07 00:00:00,0,0
2020-08-07 00:00:00,2020-08-08 00:00:00,0,0
2020-08-08 00:00:00,2020-08-09 00:00:00,0,0
2020-08-09 00:00:00,2020-08-10 00:00:00,0,0

Download occupancy statistics

This method should be used when you want to retrieve the occupancy statistics stored on your Axis camera using either JSON or plain text in a comma separated format (CSV).

  • Format: CSV or JSON
  • Method: GET

Request (CSV)

http://<servername>/a3dpc/api/export_occupancy/csv?start=<date>&end=<date>&resolution=<resolution>

Request (JSON)

http://<servername>/a3dpc/api/export_occupancy/json?start=<date>&end=<date>&resolution=<resolution>
FieldParameters
dateYYYYMMDD (start-of-day)
yesterday (start-of-day)
today (start-of-day)
now (current time)
resolutionhour
day

Return

  • Successful response: HTTP code 200 OK

Returns the occupancy statistics stored on the camera as either JSON or in plain text using the comma separated format (CSV). The first line in the CSV file contains a description of each element, while the following lines contain the corresponding data for the chosen time interval and its resolution: start, end and peak.

  • Error response: HTTP code 400 Bad Request
{
"error": {
"message": "Validation failed",
"error": [
{
"field": "<field>",
"reason": "<reason>"
}
]
}
}

Example 1

This example will show you what happens when you retrieve occupancy statistics from your camera using the JSON format. The data in this example will be from a previous day and measured in hourly intervals.

http://<servername>/a3dpc/api/export_occupancy/json?start=yesterday&end=today&resolution=hour

Sample output

{
"data": [
{
"start": "2023-01-08 00:00:00",
"end": "2023-01-08 01:00:00",
"peak": 0
},
{
"start": "2023-01-08 01:00:00",
"end": "2023-01-08 02:00:00",
"peak": 0
}
]
}

Example 2

This example will show you what happens when you retrieve the occupancy statistics from your camera using the CSV format. The data in this example will be for the current day and measured in hour intervals.

http://<servername>/a3dpc/api/export_occupancy/csv?start=yesterday&end=today&resolution=hour

Sample output (first 10 lines)

start,end,peak
2023-01-09 00:00:00,2023-01-09 01:00:00,0
2023-01-09 01:00:00,2023-01-09 02:00:00,0
2023-01-09 02:00:00,2023-01-09 03:00:00,0
2023-01-09 03:00:00,2023-01-09 04:00:00,0
2023-01-09 04:00:00,2023-01-09 05:00:00,0
2023-01-09 05:00:00,2023-01-09 06:00:00,0
2023-01-09 06:00:00,2023-01-09 07:00:00,0
2023-01-09 07:00:00,2023-01-09 08:00:00,3
2023-01-09 08:00:00,2023-01-09 09:00:00,17
2023-01-09 09:00:00,2023-01-09 10:00:00,21

Example 3

This example will show you what happens when you retrieve occupancy statistics on your camera using the CSV format for a specific date range. The data in this example will be between 2022–12–31 and up until today, measured in daily intervals.

http://<servername>/a3dpc/api/export_occupancy/csv?start=20221231&end=today&resolution=day

Sample output (first 10 lines)

start,end,peak
2022-12-31 00:00:00,2023-01-01 00:00:00,1
2023-01-01 00:00:00,2023-01-02 00:00:00,2
2023-01-02 00:00:00,2023-01-03 00:00:00,17
2023-01-03 00:00:00,2023-01-04 00:00:00,21
2023-01-04 00:00:00,2023-01-05 00:00:00,26
2023-01-05 00:00:00,2023-01-06 00:00:00,19
2023-01-06 00:00:00,2023-01-07 00:00:00,5
2023-01-07 00:00:00,2023-01-08 00:00:00,2
2023-01-08 00:00:00,2023-01-09 00:00:00,1

Request real-time data

This method should be used when you want to retrieve real-time estimated occupancy and counting statistics for the primary camera as well as its connected secondary cameras using the JSON format.

  • Format: JSON
  • Method: GET

Request

http://<servername>/a3dpc/api/occupancy

Sample output

{
"occupancy": 15,
"serial": "00:40:8c:18:82:27",
"timestamp": "2020-12-03T16:28:05+01:00",
"total_in": 100,
"total_out": 85
}

Generic data push

This method should be used when you want to push statistics stored on your Axis camera to HTTPS endpoints using the JSON format .

Please note that the generic data push functionality is configured in the AXIS 3D People Counter application, where the endpoint URL, send time interval and API token (optional) are all specified from the "Reporting" section.

  • Format: JSON
  • Method: POST

Server requirements

The remote destination must be configured by using HTTPS with a certificate validated by either a public or custom root CA, which must also be installed on your Axis camera in ensure proper encryption of the data. Supported time intervals are 1, 5 and 15 minutes.

API token

An API token can be specified for the push and be added to a request via the HTTP header Authorization: Bearer <token>

Sample output

{
"apiName": "Axis Retail Data",
"apiVersion": "0.4",
"utcSent": "2020-12-08T12:20:12Z",
"localSent": "2020-12-08T13:20:12",
"data": {
"utcFrom": "2020-12-08T12:19:00Z",
"utcTo": "2020-12-08T12:20:00Z",
"localFrom": "2020-12-08T13:19:00",
"localTo": "2020-12-08T13:20:00",
"measurements": [
{
"kind": "people-counts",
"utcFrom": "2020-12-08T12:19:00Z",
"utcTo": "2020-12-08T12:20:00Z",
"localFrom": "2020-12-08T13:19:00",
"localTo": "2020-12-08T13:20:00",
"items": [
{
"direction": "in",
"count": 0,
"adults": 0
},
{
"direction": "out",
"count": 0,
"adults": 0
}
]
}
]
},
"sensor": {
"application": "AXIS 3D People Counter",
"applicationVersion": "10.3",
"timezone": "Europe/Stockholm",
"name": "axis-accc8ef3d92e",
"serial": "accc8ef3d92e",
"ipAddress": "172.25.70.165",
}
}
FieldDescription
apiNameThe API name.
apiVersionThe version number of the API that is utilized.
utcSentThe UTC date and time when the data was delivered.
localSentThe local date and time when the data was delivered.
DataAn array containing the counting data information.
data[].utcFromThe UTC start date and time of the counting data.
data[].utcToThe UTC end date and time of the counting data.
data[].localFromThe local start date and time of the counting data.
data[].localToThe local end date and time of the counting data.
data[].measurementsAn array containing the counting data measurements.
data[].measurements[].kindThe data type provided by the Axis network camera.
data[].measurements[].utcFromThe UTC start date and time of the counting data for a specific time interval.
data[].measurements[].utcToThe UTC end date and time of the counting data for a specific time interval.
data[].measurements[].localFromThe local start date and time of the counting data for a specific time interval.
data[].measurements[].localToThe local end date and time of the counting data for a specific time interval.
data[].measurements[].itemsAn array containing the counting data for specific time interval.
data[].measurements[].items[].directionThe direction of the data recorded during specific time intervals, either in or out.
data[].measurements[].items[].countThe number of counts recorded during specific time intervals.
data[].measurements[].items[].adultsThe number of adult counts recorded during specific time intervals.
SensorAn array containing the sensor specific information.
sensor[].applicationThe people counter application type.
sensor[].timeZoneThe selected time zone for the Axis network camera.
sensor[].nameThe device name provided by the application.
sensor[].serialThe serial number of the Axis network camera.
sensor[].ipAddressThe IP address of the Axis network camera.

Adjust occupancy

This method should be used when you want to manually adjust the real-time estimated occupancy of an area with a new value.

  • Path: /axis-cgi/a3dpc.cgi
  • Security level: Operator
  • Method: POST

Request the target value 0

Request

{
"apiVersion": "1",
"context": "95eb9c7a-5b30-4b78-aafd-eeaec4e87886",
"method": "adjustOccupancy",
"params": {
"occupancy": 0
}
}
ParameterDescription
apiVersionThe API version that should be used.
contextA text string returned in the corresponding response (optional).
methodSpecifies the method.
paramsParameter group made to set the estimated occupancy.
occupancyThe new value for estimated occupancy.

Response

{
"apiVersion": "1.0",
"context": "95eb9c7a-5b30-4b78-aafd-eeaec4e87886",
"data": {
"message": "Request received, use the occupancy API to confirm that the changes have taken effect."
},
"method": "adjustOccupancy"
}
ParameterDescription
apiVersionThe API version that was used in the request.
contextA text string set by the user in the request (optional).
methodThe requested method.
paramsParameter group made to set the estimated occupancy.
occupancyThe new value for estimated occupancy.

Request rejected due to a lack of effect

Request

{
"apiVersion": "1",
"context": "34b296dc-ad63-4988-92c4-fa7928de6014",
"method": "adjustOccupancy",
"params": {
"occupancy": 0
}
}
ParameterDescription
apiVersionThe API version that should be used.
contextA text string returned in the corresponding response (optional).
methodSpecifies the method.
paramsParameter group made to set the estimated occupancy.
occupancyThe new value for estimated occupancy.

Response 1

{
"apiVersion": "1.0",
"context": "34b296dc-ad63-4988-92c4-fa7928de6014",
"error": {
"code": 1200,
"message": "Device is configured as occupancy secondary, adjust occupancy on primary device."
},
"method": "adjustOccupancy"
}
ParameterDescription
apiVersionThe API version that was used in the request.
contextA text string set by the user in the request (optional).
errorContains the error information.
codeThe error code.
messageThe error message detailing the corresponding error code.
methodThe requested method.

Error codes

CodeDescription
1200Device is configured as occupancy secondary, adjust occupancy on primary device.

Response 2

{
"apiVersion": "1.0",
"context": "34b296dc-ad63-4988-92c4-fa7928de6014",
"error": {
"code": 1200,
"message": "Occupancy estimation is off, turn it on to use this feature."
},
"method": "adjustOccupancy"
}
ParameterDescription
apiVersionThe API version that was used in the request.
contextA text string set by the user in the request (optional).
errorContains the error information.
codeThe error code.
messageThe error message detailing the corresponding error code.
methodThe requested method.

Error codes

CodeDescription
1200Occupancy estimation is off, turn it on to use this feature.

See General error codes for a complete list of potential errors.

Restart a passthrough countdown

This method should be used when you want to restart the counting from 0 without emitting any passthrough threshold events.

  • Path: /axis-cgi/a3dpc.cgi
  • Security level: Operator
  • Method: POST

Request is accepted

Request

{
"apiVersion": "1",
"context": "d661abe5-56a4-4284-baff-cc5934091fa6",
"method": "restartPassthroughCountdown"
}
ParameterDescription
apiVersionThe API version that should be used.
contextA text string returned in the corresponding response (optional).
methodSpecifies the method.

Response

{
"apiVersion": "1.0",
"context": "d661abe5-56a4-4284-baff-cc5934091fa6",
"data": {},
"method": "restartPassthroughCountdown"
}
ParameterDescription
apiVersionThe API version that was used in the request.
contextA text string set by the user in the request (optional).
dataAn array containing the counting data information.
methodThe requested method.

Request is rejected due to a lack of effect

Request

{
"apiVersion": "1",
"context": "f85d0604-db97-4747-9e9b-cdc863957a99",
"method": "restartPassthroughCountdown"
}
ParameterDescription
apiVersionThe API version that should be used.
contextA text string returned in the corresponding response (optional).
methodSpecifies the method.

Response

{
"apiVersion": "1.0",
"context": "f85d0604-db97-4747-9e9b-cdc863957a99",
"error": {
"code": 1200,
"message": "Allow passthrough threshold events is turned off."
},
"method": "restartPassthroughCountdown"
}
ParameterDescription
apiVersionThe API version that was used in the request.
contextA text string set by the user in the request (optional).
errorContains the error information.
codeThe error code.
messageThe error message detailing the corresponding error code.
methodThe requested method.

Error codes

CodeDescription
1200Allow passthrough threshold events is turned off.

See General error codes for a complete list of potential errors.

General error codes

CodeDescription
1100Internal error
2100API version not supported
2101Invalid JSON
2102Method not supported
2103Required parameter missing
2104Invalid parameter value specified
2105Authorization failed
2106Authentication failed
2107Transport level error

3D people counter API (Old version)

note

This API has been deprecated and will no longer receive any updates. Please note that it is not compatible with the AXIS P8815-2 3D People Counter.

Common examples

Open all statistics that are stored in the camera with a one minute resolution, using a browser.

Request (CSV)

http://<servername>/stereo/people-counter/export.csv?export-method=on&date=YYYYMMDD&resolution=60&method=open

See List download statistics for more information.

Download statistics that occurred on the 10th of January of 2017.

Request (JSON)

http://<servername>/stereo/people-counter/export.json?resolution=day&date=20170110&method=download

See List download statistics for more information.

API specification

Request real-time data

Returns JSON file with real time counting data.

  • Format: JSON
  • Method: GET

Request

http://<servername>/stereo/people-counter/counts.json

Return

{
"in": 0,
"name": "Untitled AXIS 3D People Counter",
"out": 0,
"serial": "ACCC8E235294",
"timestamp": "20180115121710"
}

Return value descriptions

ValueDescription
inNumber of people passing in until now today.
nameThe name of the application, chosen by the client.
outNumber of people passing out until now.
serialThe Mac address for the camera.
timestampTime in the camera in the format YYYYMMDDhhmmss.

List download statistics

Returns statistics stored in the camera in JSON or plain text comma separated format (CSV)

  • Format: CSV or JSON
  • Method: GET

Request (CSV)

http://<servername>/stereo/people-counter/export.csv?resolution=<resolution>&date=<date>&method=<method>

Request (JSON)

http://<servername>/stereo/people-counter/export.json?resolution=<resolution>&date=<date>&method=<method>

Request parameter descriptions

ParameterDescription
<date>a date of the form YYYYMMDD
a date interval of the form YYYYMMDD-YYYYMMDD
comma separated dates of the form YYYYMMDD,[..],YYYYMMDD
all (default) for all available data
<resolution>minute for data in 1 minute bins
hour for data in 1 hour bins
day for data in 1 day bins
60 for data in 1 minute bins
3600 for data in 1 hour bins
86400 for data in 1 day bins
<method>select open to list the statistics in a web browser
select download to download the JSON or CSV file

Return

Returns statistics stored in the camera in JSON or plain text comma separated format (CSV). The first line of the CSV file contains a description of each element, and the following lines contain the corresponding data for the chosen time interval and resolution: Interval Start, Interval Start (Unixtime), In, Out

List frame rate

Returns the current internal frame rate

  • Format: JSON
  • Method: GET

Request

http://<servername>/stereo/fps.json

Return

{
"fps": real time fps,
"fps_100": average FPS for the last 100 frames,
"fps_1000": average FPS for the last 1000 frames,
"fps_5": average FPS for the last 5 frames,
"fps_50": average FPS for the last 50 frames,
"frames": frame counter.
}

I/O interface

Get the latest I/O signals as false or true.

  • Format: JSON
  • Method: GET

Request

http://<servername>/stereo/io.json

Return

"True" or "False"

List parameters

Get all parameters currently set.

  • Format: JSON
  • Method: GET

Request

http://<servername>/stereo/params.json

Return

A JSON object of all the parameters currently set.