Alerts

Alert object

Alert object is the backbone of reporting and it keeps all elements of an alert. Alerts can be queried by string parameters and camera. Alert API works with unix timestamp as the start and end time of the queried alerts and those are required for all type of API calls. So it returns alerts, which created in the given time period only.

It is recommended to use frequent API calls by keeping the distance between start and end time, because it is easier to manage less alerts at a time. However there is no limitation on start and end times, it is completely up to your scripting structure.

Sample Alert Object

You can see all elements of the alert object at the json below.

{
"id": "132a53cb-c9c4-9924-2a28-j24d4af93af",
"cameraId": "3b084a37-6fd4-4c1b-beea-eg403217751b",
"name": "STATIC_DELIMITATION_AREA",
"count": 2,
"createdAt": "2020-08-09T11:55:08Z",
"url": "https://images.intenseye.com/e1d2e50a-58f0-4a14-806f-f3968e52810f-1581666181.jpg",
"imageDimensions": {
"width": 1920,
"height": 1080
},
"canvasDimensions": {
"width": 1466,
"height": 895
},
"violatingCoordinates": [
{
"x": 713,
"y": 463
}
],
"area": [
{
"x": 713,
"y": 463
},
{
"x": 854,
"y": 510
},
{
"x": 302,
"y": 181
},
{
"x": 456,
"y": 388
}
],
"storageClass": "s3",
"info": {},
"bookmark": false,
"alertRuleId": "310e824b-2696-4595-af1a-1ce2bbbb41ec",
"localCreatedAt": "2020-08-09T14:55:08Z",
"falsePositive": false,
"thumbnailUrl": "https://images.intenseye.com/e1d2e50a-58f0-4a14-806f-f3968e52810f-1581666181.jpg",
"workspaceId": "f213e5dd-4b92-46f0-95df-0b9dfff4e588",
"areaIds": []
}

Endpoints


Query alerts based on time interval

GET/alerts

Arguments

QUERY STRING PARAMETERS
  • start Long required The timestamp where the alerts are happened later
  • end Long required The timestamp where the alerts are happened earlier
  • page Int optional Page number to retrieve the alerts. First page includes most recent alerts. (Defaults to 1)
  • count Int optional Number of alerts to retrieve. (Defaults to 20)
  • facilityId UUID optional Id of the facility to filter results
  • cameraId List[UUID] Id of the camera to filter results
  • type List[String] optional Filter by alert type.
  • severity List[String] optional Filter by alert severity.
  • bookmark Boolean optional Filter by bookmark
  • areaId UUID optional Filter by areaId

Returns

Returns a list of alert object for the camera that was provided in the request.

{
"status": "ok",
"data": {
"page": 1,
"count": 10,
"total": 139,
"alerts": [
{
"id": "132a53cb-c9c4-9924-2a28-j24d4af93af",
"cameraId": "3b084a37-6fd4-4c1b-beea-eg403217751b",
"name": "STATIC_DELIMITATION_AREA",
"count": 2,
"createdAt": "2020-08-09T11:55:08Z",
"url": "https://images.intenseye.com/e1d2e50a-58f0-4a14-806f-f3968e52810f-1581666181.jpg",
"imageDimensions": {
"width": 1920,
"height": 1080
},
"canvasDimensions": {
"width": 1466,
"height": 895
},
"violatingCoordinates": [
{
"x": 713,
"y": 463
}
],
"area": [
{
"x": 713,
"y": 463
},
{
"x": 854,
"y": 510
},
{
"x": 302,
"y": 181
},
{
"x": 456,
"y": 388
}
],
"storageClass": "s3",
"info": {},
"bookmark": false,
"alertRuleId": "310e824b-2696-4595-af1a-1ce2bbbb41ec",
"localCreatedAt": "2020-08-09T14:55:08Z",
"falsePositive": false
}]
}
}

Query alerts by camera

GET/cameras/:cameraId/alerts

Arguments

PATH PARAMETERS
  • :cameraId UUID Id of the camera
QUERY STRING PARAMETERS
  • start Long required The timestamp where the alerts are happened later
  • end Long required The timestamp where the alerts are happened earlier

Returns

Returns a list of alert object for the camera that was provided in the request.

{
"status": "ok",
"data": {
"page": 1,
"count": 10,
"total": 139,
"alerts": [
{
"id": "132a53cb-c9c4-9924-2a28-j24d4af93af",
"cameraId": "3b084a37-6fd4-4c1b-beea-eg403217751b",
"name": "STATIC_DELIMITATION_AREA",
"count": 2,
"createdAt": "2020-08-09T11:55:08Z",
"url": "https://images.intenseye.com/e1d2e50a-58f0-4a14-806f-f3968e52810f-1581666181.jpg",
"imageDimensions": {
"width": 1920,
"height": 1080
},
"canvasDimensions": {
"width": 1466,
"height": 895
},
"violatingCoordinates": [
{
"x": 713,
"y": 463
}
],
"area": [
{
"x": 713,
"y": 463
},
{
"x": 854,
"y": 510
},
{
"x": 302,
"y": 181
},
{
"x": 456,
"y": 388
}
],
"storageClass": "s3",
"info": {},
"bookmark": false,
"alertRuleId": "310e824b-2696-4595-af1a-1ce2bbbb41ec",
"localCreatedAt": "2020-08-09T14:55:08Z",
"falsePositive": false
}]
}
}

Get last (simplified) alert in a camera by type

GET/cameras/:cameraId/alerts/last

Arguments

PATH PARAMETERS
  • :cameraId UUID required Id of the camera
QUERY STRING PARAMETERS
  • alertType String required Type of the alert

Returns

Returns an (simplified) alert object

{
"status": "ok",
"data": {
"id": "9c6a2ef7-6ae3-4324-b7e3-1bbe975f24e2",
"cameraId": "af5dec06-fda4-43f9-8878-2b27e7e3aaf7",
"name": "MIN_WORKER_IN_CONFINED_SPACE",
"createdAt": "2020-11-12T13:51:07Z",
"alertRuleId": "bbb0f794-2e00-4c8e-847c-c2bf55c0b164",
"localCreatedAt": "2020-11-12T16:51:07Z"
}
}

Get alert count of a camera

GET/cameras/:cameraId/alerts/count

Arguments

PATH PARAMETERS
  • :cameraId UUID required Id of the camera to retrieve
QUERY STRING PARAMETERS
  • start Long required Start of the timestamp
  • end Long required End of the timestamp
  • aggregate Enum required
    • day
    • week
    • month Aggregation identifier

Returns

Returns list of alert counts

{
"status": "ok",
"data": [
{
"key": "keyName",
"count": 10
},
{
"key": "keyName2",
"count": 20
}
]
}

Delete an alert

DELETE/alerts/:alertId

Roles:

alerts:delete

Arguments

PATH PARAMETERS
  • :alertId UUID required Id of the alert

Returns

Returns a success message

{
"status": "ok",
"message": "Alert deleted"
}

Delete alerts

DELETE/alerts

Roles:

alerts:delete

Arguments

QUERY STRING PARAMETERS
  • :alertId List[UUID] required Ids of the alert

Returns

Returns a success message

{
"status": "ok",
"message": "Alerts deleted"
}

Export alerts between dates

GET/alerts/export

Roles:

alerts:read

Arguments

QUERY STRING PARAMETERS
  • start Long required The timestamp where the alerts are happened later
  • end Long required The timestamp where the alerts are happened earlier
  • facilityId UUID optional Id of the facility to filter results
  • cameraId UUID optional Id of the camera to filter results
  • type List[String] optional Filter by alert type.
  • severity List[String] optional Filter by list of alert severities.
  • bookmark Boolean optional Filter by bookmark
  • observation Boolean optional Filter by observation
  • areaId UUID optional Filter by areaId
  • falsePositive List[Boolean] optional Filter by false positive value

Returns

Returns an "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" with headers "Content-Disposition" -> s"attachment; filename=$fileName.xlsx")