Skip to main content
Skip table of contents

Analytics case update. Line crossing detection

Creating a analytics case with the type «Line crossing detection».

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": "Line crossing detection",
    "type": "line-intersection",
    "cameras": [
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 25
                }
            ],
            "meta": {
                "line": [
                    {
                        "x": 0.1734375,
                        "y": 0.38055555555555554
                    },
                    {
                        "x": 0.38125,
                        "y": 0.8666666666666667
                    },
                    {
                        "x": 0.89375,
                        "y": 0.5833333333333334
                    },
                    {
                        "x": 0.753125,
                        "y": 0.21666666666666667
                    }
                ]
            }
        },
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 25
                }
            ],
            "meta": {
                "line": [
                    {
                        "x": 0.203125,
                        "y": 0.37222222222222223
                    },
                    {
                        "x": 0.8171875,
                        "y": 0.8777777777777778
                    }
                ]
            }
        }
    ]
}

caseoptional

int

Unique identifier of the analytics case to be updated

titlerequired

string

Name of the analytics case

camerasrequired

array

Array of camera objects with event and reaction specifications

cameras.*.idrequired

array

Camera ID

cameras.*.scriptsrequired

array

Array of event and reaction IDs

cameras.*.scripts.*.idrequired

int

Event and reaction IDs, see Creating an event and reaction

cameras.*.meta.linerequired

array

Line across which the selected type of analytics will be triggered. It is an array of relative coordinates (starting and ending points of the line) ranging from 0 to 1

cameras.*.analytic_case_camera_user_statusrequired

str

Updating the status of the analytics case. Use «pause» to pause an individual camera of the case and «unpause» to resume it

camerasrequired

array

Array of camera objects to be deleted, along with the deletion type

cameras.*.idrequired

int

Camera ID

cameras.*.forcerequired

bool

Deletion type. Use «true» for complete deletion of the case and «false» to mark the case as deleted. Existing events will remain, but no new events will be received

Response

201

Returns the analytics case

JSON
{
    "id": 52,
    "title": "Line crossing detection",
    "type": "line-intersection",
    "type_pretty": "Line crossing detection",
    "status": "active",
    "cameras": [
        {
            "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 1",
            "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": 25,
                    "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:50:21",
                    "updated_at": "2022-12-21 12:50:21",
                    "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": 12,
                        "name": "line-intersection",
                        "description": "Line crossing detection",
                        "color": "#813A79",
                        "analytic_type": "line-intersection"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "line": [
                    {
                        "x": 0.1734375,
                        "y": 0.38055555555555554
                    },
                    {
                        "x": 0.38125,
                        "y": 0.8666666666666667
                    },
                    {
                        "x": 0.89375,
                        "y": 0.5833333333333334
                    },
                    {
                        "x": 0.753125,
                        "y": 0.21666666666666667
                    }
                ]
            },
            "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 1"
        },
        {
            "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 2",
            "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": 25,
                    "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:50:21",
                    "updated_at": "2022-12-21 12:50:21",
                    "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": 12,
                        "name": "line-intersection",
                        "description": "Line crossing detection",
                        "color": "#813A79",
                        "analytic_type": "line-intersection"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "line": [
                    {
                        "x": 0.203125,
                        "y": 0.37222222222222223
                    },
                    {
                        "x": 0.8171875,
                        "y": 0.8777777777777778
                    }
                ]
            },
            "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 2"
        }
    ],
    "created_at": "2022-12-21 12:50:39",
    "updated_at": "2022-12-21 12:50:39",
    "color": "#5CBCE7",
    "available_events": [],
    "is_fails_exists": true,
    "errors": [
        "Error creating camera Camera 2."
    ]
}
401

Authorization token is missing or invalid, see Obtaining a token

402

The license limit for the selected analytics case has been exceeded

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": "Line crossing detection",
    "type": "line-intersection",
    "cameras": [
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 25
                }
            ],
            "meta": {
                "line": [
                    {
                        "x": 0.1734375,
                        "y": 0.38055555555555554
                    },
                    {
                        "x": 0.38125,
                        "y": 0.8666666666666667
                    },
                    {
                        "x": 0.89375,
                        "y": 0.5833333333333334
                    },
                    {
                        "x": 0.753125,
                        "y": 0.21666666666666667
                    }
                ]
            }
        },
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 25
                }
            ],
            "meta": {
                "line": [
                    {
                        "x": 0.203125,
                        "y": 0.37222222222222223
                    },
                    {
                        "x": 0.8171875,
                        "y": 0.8777777777777778
                    }
                ]
            }
        }
    ]
}'
JavaScript errors detected

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

If this problem persists, please contact our support.