Skip to main content
Skip table of contents

Analytics case update. Counting people in the area

Update analytics case with type «Counting people in the area».

PUT/api/v1/analytic-case/{case}

Headers

Authorization

Bearer token

Accept

application/json

X-Client

ios-cctv|android-cctv|thick-legal|web

X-UUID

unique device id

Body

json

JSON
{
    "title": "Counting people in the area",
    "type": "person_counting",
    "cameras": [
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 20
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.1484375,
                        "y": 0.2222222222222222
                    },
                    {
                        "x": 0.3453125,
                        "y": 0.7722222222222223
                    },
                    {
                        "x": 0.840625,
                        "y": 0.625
                    },
                    {
                        "x": 0.79375,
                        "y": 0.1527777777777778
                    }
                ],
                "reaction_after_value": 3
            }
        },
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 20
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.1625,
                        "y": 0.3194444444444444
                    },
                    {
                        "x": 0.4203125,
                        "y": 0.925
                    },
                    {
                        "x": 0.9390625,
                        "y": 0.7222222222222222
                    },
                    {
                        "x": 0.7734375,
                        "y": 0.1527777777777778
                    }
                ],
                "reaction_after_value": 3
            }
        }
    ]
}

caseoptional

int

Unique identifier of the analytics case to be updated

titlerequired

string

Name of the analytics case to be updated

camerasrequired

array

Array of camera objects with specified events and reactions

cameras.*.idrequired

array

Camera ID

cameras.*.scriptsrequired

array

Array of event and reaction IDs

cameras.*.scripts.*.idrequired

int

Event and reaction ID, see Creating an event and reaction

cameras.*.meta.figurerequired

array

Defined area of the camera to be processed by the analytics. It is passed as an array of coordinates (bend points of the line) in relative values from 0 to 1. The number of points can range from three to n. The last coordinate should not be passed, the area will be closed with the initial coordinate

cameras.*.meta.reaction_after_valuerequired

int

Minimum number of people in the area to trigger the reaction. Required only for the «Counting people in the area» case

cameras.*.analytic_case_camera_user_statusrequired

str

Change the status of the case. "pause" - pause the individual camera of the case, "unpause" - resume the individual camera of the case

camerasrequired

array

Array of camera objects to be deleted, specifying the deletion type

cameras.*.idrequired

int

Camera ID

cameras.*.forcerequired

bool

Deletion type. "true" - complete deletion of the case, "false" - mark the case as deleted while keeping existing events, but no new events will be generated

Response

200

Returns an analytics case

JSON
{
    "id": 42,
    "title": "Counting people in the area",
    "type": "person_counting",
    "type_pretty": "Counting people in the 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": "Camera 1",
            "pretty_text": "Cameras",
            "short_address": "Cameras",
            "full_address": "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,
                    "title": "Set a 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": "user",
                            "name": "user",
                            "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": "Counting people in the area",
                        "color": "#FF7CF2",
                        "analytic_type": "person_counting"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.1484375,
                        "y": 0.2222222222222222
                    },
                    {
                        "x": 0.3453125,
                        "y": 0.7722222222222223
                    },
                    {
                        "x": 0.840625,
                        "y": 0.625
                    },
                    {
                        "x": 0.79375,
                        "y": 0.1527777777777778
                    }
                ],
                "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",
            "event": null,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "Camera 1"
        },
        {
            "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": "Camera 2",
            "pretty_text": "Cameras",
            "short_address": "Cameras",
            "full_address": "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,
                    "title": "Set a 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": "user",
                            "name": "user",
                            "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": "Counting people in the area",
                        "color": "#FF7CF2",
                        "analytic_type": "person_counting"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.1625,
                        "y": 0.3194444444444444
                    },
                    {
                        "x": 0.4203125,
                        "y": 0.925
                    },
                    {
                        "x": 0.9390625,
                        "y": 0.7222222222222222
                    },
                    {
                        "x": 0.7734375,
                        "y": 0.1527777777777778
                    }
                ],
                "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,
            "event": null,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "Camera 2"
        }
    ],
    "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": [
        "Erroe creating camera Camera 1."
    ]
}
401

Authorization token not provided or invalid, see Obtaining a token

402

License limit exceeded for the selected analytics case

422

Returns a JSON object with an error, see Validation

JSON
{
    "message": "There won't be any informative message here",
    "errors": {
        "any_key": [
            "Here the error cause will be described"
        ]
    }
}

Example

JSON
curl -k --location --request PUT 'https://vms.local/api/v1/analytic-case/{case}' \
--header 'Authorization:Bearer token' \
--header 'Accept:application/json' \
--header 'X-Client:ios-cctv|android-cctv|thick-legal|web' \
--header 'X-UUID:unique device id' \
--header 'Content-Type: application/json \
--data-raw '{
    "title": "Counting people in the area",
    "type": "person_counting",
    "cameras": [
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 20
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.1484375,
                        "y": 0.2222222222222222
                    },
                    {
                        "x": 0.3453125,
                        "y": 0.7722222222222223
                    },
                    {
                        "x": 0.840625,
                        "y": 0.625
                    },
                    {
                        "x": 0.79375,
                        "y": 0.1527777777777778
                    }
                ],
                "reaction_after_value": 3
            }
        },
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 20
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.1625,
                        "y": 0.3194444444444444
                    },
                    {
                        "x": 0.4203125,
                        "y": 0.925
                    },
                    {
                        "x": 0.9390625,
                        "y": 0.7222222222222222
                    },
                    {
                        "x": 0.7734375,
                        "y": 0.1527777777777778
                    }
                ],
                "reaction_after_value": 3
            }
        }
    ]
}'
JavaScript errors detected

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

If this problem persists, please contact our support.