Skip to main content
Skip table of contents

Create an analytics case. Smoke and fire detection

Creating an Analytics case with the type «Smoke and fire detection».

An automatic tool for localizing and detecting smoke and open fire in a designated area of the video stream. This business case can be applied in various scenarios where there is a need to establish the presence of smoke or fire with mandatory alerts based on predefined detection thresholds. The business case is suitable for small, enclosed spaces.

Event: Smoke/Fire Detection

POST/api/v1/analytic-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": "Smoke and fire detection",
    "type": "smoke-fire",
    "cameras": [
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 24
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.26875,
                        "y": 0.3277777777777778
                    },
                    {
                        "x": 0.4,
                        "y": 0.7694444444444445
                    },
                    {
                        "x": 0.79375,
                        "y": 0.5777777777777777
                    },
                    {
                        "x": 0.703125,
                        "y": 0.13333333333333333
                    }
                ]
            }
        },
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 24
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.18125,
                        "y": 0.31666666666666665
                    },
                    {
                        "x": 0.3859375,
                        "y": 0.9
                    },
                    {
                        "x": 0.9203125,
                        "y": 0.7
                    },
                    {
                        "x": 0.784375,
                        "y": 0.175
                    }
                ]
            }
        }
    ]
}

titlerequired

string

Analytics case name

typerequired

string

For this case type, the value "smoke-fire" should always be provided

camerasrequired

array

Array of camera objects specifying the event and reaction

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

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

Response

201

Returns the analytics case

JSON
{
    "id": 50,
    "title": "Smoke and fire detection",
    "type": "smoke-fire",
    "type_pretty": "Smoke and fire detection",
    "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": 24,
                    "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:48:58",
                    "updated_at": "2022-12-21 12:48:58",
                    "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": 11,
                        "name": "smoke-fire",
                        "description": "Smoke and fire detection",
                        "color": "#FF5A3F",
                        "analytic_type": "smoke-fire"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.26875,
                        "y": 0.3277777777777778
                    },
                    {
                        "x": 0.4,
                        "y": 0.7694444444444445
                    },
                    {
                        "x": 0.79375,
                        "y": 0.5777777777777777
                    },
                    {
                        "x": 0.703125,
                        "y": 0.13333333333333333
                    }
                ]
            },
            "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": 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": 24,
                    "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:48:58",
                    "updated_at": "2022-12-21 12:48:58",
                    "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": 11,
                        "name": "smoke-fire",
                        "description": "Smoke and fire detection",
                        "color": "#FF5A3F",
                        "analytic_type": "smoke-fire"
                    },
                    "extra": null
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.18125,
                        "y": 0.31666666666666665
                    },
                    {
                        "x": 0.3859375,
                        "y": 0.9
                    },
                    {
                        "x": 0.9203125,
                        "y": 0.7
                    },
                    {
                        "x": 0.784375,
                        "y": 0.175
                    }
                ]
            },
            "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:49:16",
    "updated_at": "2022-12-21 12:49:16",
    "color": "#DE2000",
    "available_events": [],
    "is_fails_exists": false
}
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 POST 'https://vms.local/api/v1/analytic-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": "Smoke and fire detection",
    "type": "smoke-fire",
    "cameras": [
        {
            "id": 10,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 24
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.26875,
                        "y": 0.3277777777777778
                    },
                    {
                        "x": 0.4,
                        "y": 0.7694444444444445
                    },
                    {
                        "x": 0.79375,
                        "y": 0.5777777777777777
                    },
                    {
                        "x": 0.703125,
                        "y": 0.13333333333333333
                    }
                ]
            }
        },
        {
            "id": 7,
            "analytic_case_camera_user_status": null,
            "scripts": [
                {
                    "id": 24
                }
            ],
            "meta": {
                "figure": [
                    {
                        "x": 0.18125,
                        "y": 0.31666666666666665
                    },
                    {
                        "x": 0.3859375,
                        "y": 0.9
                    },
                    {
                        "x": 0.9203125,
                        "y": 0.7
                    },
                    {
                        "x": 0.784375,
                        "y": 0.175
                    }
                ]
            }
        }
    ]
}'
JavaScript errors detected

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

If this problem persists, please contact our support.