Skip to main content
Skip table of contents

Create an analytics cases for counting people

Creating analytics cases

Creating an analytics case with the “Counting objects in an area” type. A tool for automatically localizing and establishing the exact number of people in a designated area of ​​a video stream. Event: detection and counting of the number of objects (people) located in the detection zone of the selected camera.

JSON
{
    "title": "Counting objects in an area",
    "type": "person-counting",
    "cameras": [
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 20,
                    "is_enabled": true
                }
            ],
            "meta": {
                "figures": [
                    {
                        "name": "Figure 1",
                        "coords": [
                            {
                                "x": 0.153125,
                                "y": 0.31666666666666665
                            },
                            {
                                "x": 0.3421875,
                                "y": 0.7361111111111112
                            },
                            {
                                "x": 0.86875,
                                "y": 0.6472222222222223
                            },
                            {
                                "x": 0.78125,
                                "y": 0.125
                            }
                        ]
                    }
                ],
                "reaction_after_value": 3
            }
        },
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 20,
                    "is_enabled": false
                }
            ],
            "meta": {
                "figures": [
                    {
                        "name": "Figure 1",
                        "coords": [
                            {
                                "x": 0.153125,
                                "y": 0.31666666666666665
                            },
                            {
                                "x": 0.3421875,
                                "y": 0.7361111111111112
                            },
                            {
                                "x": 0.86875,
                                "y": 0.6472222222222223
                            },
                            {
                                "x": 0.78125,
                                "y": 0.125
                            }
                        ]
                    }
                ],
                "reaction_after_value": 3
            }
        }
    ]
}

POST /api/v1/analytic-case

Parameters

string title, Analytics case title


string type, For this type of case, you must always send the value person-counting


array cameras, An array of camera objects indicating the event and reaction

object array

int

 

cameras.

 

REQUIRED

, .meta.reaction_after_value The number of people in the area at which the reaction will be triggered.


int

 

cameras.

 

REQUIRED

, .meta.reaction_after_value The number of people in the area at which the reaction will be triggered.


int

 

cameras.

 

REQUIRED

, .meta.reaction_after_value The number of people in the area at which the reaction will be triggered.


int

 

cameras.

 

REQUIRED

, .meta.reaction_after_value The number of people in the area at which the reaction will be triggered.


int

 

cameras.

 

REQUIRED

, .meta.reaction_after_value The number of people in the area at which the reaction will be triggered.


int

 

cameras.

 

REQUIRED

, .meta.reaction_after_value The number of people in the area at which the reaction will be triggered.


201 Created

Returns the analytics case

JSON
{
    "id": 42,
    "title": "Counting objects in an area",
    "type": "person-counting",
    "type_pretty": "Count objects in area",
    "status": "active",
    "cameras": [
        {
            "id": 10,
            "group_id": 2,
            "status": "active",
            "type": "media_server_v2",
            "start_at": "",
            "created_at": "2022-12-16 10:25:55",
            "billing_id": null,
            "pretty_name": "manual retransfer Fence (gate top view)",
            "pretty_text": "Test cameras, manual cameras",
            "short_address": "Test cameras, manual cameras",
            "full_address": "Test cameras, manual cameras",
            "lat": null,
            "lng": null,
            "azimuth": null,
            "streams": [
                {
                    "id": 19,
                    "type": "high",
                    "camera_id": 10,
                    "is_preview_from_server": true,
                    "is_archive_from_server": null,
                    "status": "active",
                    "has_sound": false,
                    "width": null,
                    "height": null
                },
                {
                    "id": 20,
                    "type": "low",
                    "camera_id": 10,
                    "is_preview_from_server": true,
                    "is_archive_from_server": null,
                    "status": "active",
                    "has_sound": false,
                    "width": null,
                    "height": null
                }
            ],
            "has_sound": false,
            "archive_ranges": [],
            "archive_recording_timetable": null,
            "is_archive_recording": false,
            "archive_recording_type": "fulltime",
            "can_change_archive_timetable": false,
            "scripts": [
                {
                    "id": 20,
                    "is_enabled": true,
                    "title": "Set label",
                    "schedule": [],
                    "timetable": {
                        "days": [
                            {
                                "to": "23:59:00+05:00",
                                "from": "00:00:00+05:00",
                                "type": "same_every_day",
                                "breaks": []
                            }
                        ],
                        "intervals": []
                    },
                    "status": "active",
                    "created_at": "2022-12-21 12:41:39",
                    "updated_at": "2022-12-21 12:41:39",
                    "users": [
                        {
                            "id": 5,
                            "login": "170500",
                            "name": "170500",
                            "parent_id": null,
                            "created_at": "2022-12-06 20:20:58",
                            "updated_at": "2022-12-21 10:53:45",
                            "access_token_id": null,
                            "can_update_password": true
                        }
                    ],
                    "event": {
                        "id": 3,
                        "name": "person-counting",
                        "description": "Count objects in an area",
                        "color": "#FF7CF2",
                        "analytic_type": "person-counting"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "figures": [
                    {
                        "name": "Figure 1",
                        "coords": [
                            {
                                "x": 0.153125,
                                "y": 0.31666666666666665
                            },
                            {
                                "x": 0.3421875,
                                "y": 0.7361111111111112
                            },
                            {
                                "x": 0.86875,
                                "y": 0.6472222222222223
                            },
                            {
                                "x": 0.78125,
                                "y": 0.125
                            }
                        ]
                    }
                ],
                "reaction_after_value": 3
            },
            "analytic_case_camera_status": "inactive",
            "analytic_case_camera_status_pretty": "Camera inactive",
            "analytic_case_camera_user_status": "failed_to_create",
            "analytic_case_camera_user_status_pretty": "Creation error",
            "analytic_notification": {
                "title": "Error reading video stream",
                "expired_at": "2024-02-15T09:22:15.192128Z"
            },
            "analytic_case_camera_uuid": "cca769c0-ea88-4e7d-88c7-6d5beb66de97",
            "event": null,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "manual retransfer Fence (gate top view)"
        },
        {
            "id": 7,
            "group_id": 2,
            "status": "inactive",
            "type": "media_server_v2",
            "start_at": "",
            "created_at": "2022-12-16 10:25:54",
            "billing_id": null,
            "pretty_name": "manual Analitika 5",
            "pretty_text": "Test cameras, manual cameras",
            "short_address": "Test cameras, manual cameras",
            "full_address": "Test cameras, manual cameras",
            "lat": null,
            "lng": null,
            "azimuth": null,
            "streams": [
                {
                    "id": 13,
                    "type": "high",
                    "camera_id": 7,
                    "is_preview_from_server": true,
                    "is_archive_from_server": null,
                    "status": "active",
                    "has_sound": false,
                    "width": null,
                    "height": null
                },
                {
                    "id": 14,
                    "type": "low",
                    "camera_id": 7,
                    "is_preview_from_server": true,
                    "is_archive_from_server": null,
                    "status": "active",
                    "has_sound": false,
                    "width": null,
                    "height": null
                }
            ],
            "has_sound": false,
            "archive_ranges": [],
            "archive_recording_timetable": null,
            "is_archive_recording": false,
            "archive_recording_type": "fulltime",
            "can_change_archive_timetable": false,
            "scripts": [
                {
                    "id": 20,
                    "is_enabled": true,
                    "title": "Set label",
                    "schedule": [],
                    "timetable": {
                        "days": [
                            {
                                "to": "23:59:00+05:00",
                                "from": "00:00:00+05:00",
                                "type": "same_every_day",
                                "breaks": []
                            }
                        ],
                        "intervals": []
                    },
                    "status": "active",
                    "created_at": "2022-12-21 12:41:39",
                    "updated_at": "2022-12-21 12:41:39",
                    "users": [
                        {
                            "id": 5,
                            "login": "170500",
                            "name": "170500",
                            "parent_id": null,
                            "created_at": "2022-12-06 20:20:58",
                            "updated_at": "2022-12-21 10:53:45",
                            "access_token_id": null,
                            "can_update_password": true
                        }
                    ],
                    "event": {
                        "id": 3,
                        "name": "person-counting",
                        "description": "Count objects in an area",
                        "color": "#FF7CF2",
                        "analytic_type": "person-counting"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "figures": [
                    {
                        "name": "Figure 1",
                        "coords": [
                            {
                                "x": 0.153125,
                                "y": 0.31666666666666665
                            },
                            {
                                "x": 0.3421875,
                                "y": 0.7361111111111112
                            },
                            {
                                "x": 0.86875,
                                "y": 0.6472222222222223
                            },
                            {
                                "x": 0.78125,
                                "y": 0.125
                            }
                        ]
                    }
                ],
                "reaction_after_value": 3
            },
            "analytic_case_camera_status": "active",
            "analytic_case_camera_status_pretty": "Camera active",
            "analytic_case_camera_user_status": null,
            "analytic_case_camera_user_status_pretty": null,
            "analytic_notification": null,
            "analytic_case_camera_uuid": "cca769c0-ea88-4e7d-88c7-6d5beb66de97",
            "event": null,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "manual Analitika 5"
        }
    ],
    "created_at": "2022-12-21 12:41:54",
    "updated_at": "2022-12-21 12:41:54",
    "color": "#F027DC",
    "available_events": [],
    "is_fails_exists": true,
    "errors": [
        "Error creating camera manual retransfer Fence (gate top view)."
    ]
}

401 Unauthorized

Authorization token not sent or not valid

402 Payment Required

The license limit for the selected analytics case has been exceeded

422 Unprocessable Entity

Returns a JSON object with an error.

JSON
{
    "message": "There will be no informative message here",
    "errors": {
        "any_key": [
            "The cause of the error will be described here"
        ]
    }
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/v1/analytic-case' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "title": "string",
    "type": "string",
    "cameras": {
        "": 0
    },
    "cameras.": "void"
}'
PHP
PHP
$data = array (
  'title' => 'string',
  'type' => 'string',
  'cameras' => 
  array (
    '' => 0,
  ),
  'cameras.' => 'void',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v1/analytic-case', false, $context);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.