NOTIFICATIONS AND SUBSCRIBERS
Overview
Use the Notifications API to:
- Get all notification profiles
- Get a single notification profile
- Get a notification types
- Create a notification profile which generates notifications
- Update a notification profile
- Delete a notification profile
A subscriber can subscribe to alarm-type notification profiles to receive notifications via email or SMS text message. Use the Subscribers API to:
- Get all subscribers
- Get a single subscriber
- Get a notification types
- Create a subscriber
- Update a subscriber
- Delete a subscriber
HTTP Headers
The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Notifications API or the Subscribers API, set the following headers:
| Header Name | Example Value | Description |
|---|---|---|
| X-User-Email | admin@example.com | Email of the user performing HTTP requests to the API. |
| X-User-Token | Drv3yU7PdyqUMtr89erZ | Token allowing user access to the API. |
| X-User-Project | OfOgUA4kTs2HrmYYlFw6Jg | Project identifier. Value of the project.uid field. |
Set header X-USER-EMAIL
Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the email address returned in the response, set:
X-USER-EMAIL = data.email
Set header X-USER-TOKEN
Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the authentication token returned in the response, set:
X-USER-TOKEN = data.token
Set header X-USER-PROJECT
Send a request to get projects using GET api/projects/ described in the Projects API. You must send this request with headers X-USER-EMAIL and X-USER-TOKEN already set. Using the project UID returned in the response, set:
X-USER-PROJECT = projects[i].uid
Notifications and Subscribers Endpoints
| Functionality | Method | Endpoint |
|---|---|---|
| get notifications | GET | api/notifications |
| get single notification | GET | api/notifications/{uid} |
| create notification | POST | api/notifications |
| edit notification | PUT | api/notifications/{uid} |
| delete notification | DELETE | api/notifications/{uid} |
| get notification types | GET | api/notification_types |
| get subscribers | GET | api/subscribers |
| get single subscriber | GET | api/subscribers/{uid} |
| create subscriber | POST | api/subscribers |
| edit subscriber | PUT | api/subscriber/{uid} |
| delete subscriber | DELETE | api/subscriber/{uid} |
Endpoints
Get notifications
GET api/notifications
Get all notification profiles for your project.
Response Fields
| Field | Description |
|---|---|
| project_uid | The unique identifier of the project. |
| id | The identifier of the notification profile in the context of the server. |
| uid | The unique identifier of the notification profile. |
| name | The user-defined name of the notification profile. |
| conditions | A JSON object with information about the conditions of the notification profile. |
| conditions.zone_severity_level | The user-defined zone violation severity level condition of the notification profile. A notification is generated for every zone violation alarm with the specified severity level and higher. For more information on zone violation severity levels, see Zones API. |
| conditions.alarm_type_list | Alarm type for triggering alarm |
| active | Whether the notification profile is active. Inactive notification profiles do not send notifications. |
| types | A JSON object with information about the method that notifications are sent to subscribers subscribed to the notification profile. |
| types.email | Whether the subscribers to the notification profile can receive notifications via email. |
| types.phone | Whether the subscribers to the notification profile can receive notifications via SMS message. |
| created_at | The UTC time stamp of when the notification profile was created. |
| updated_at | The UTC time stamp of when the notification profile was last updated. |
| removed_at | The UTC time stamp of when the notification profile was deleted, if it was. |
| notification_type | The type of notification. There are two types of notification profiles:
|
Example Response
{
"notifications": [
{
"project_uid": "HuGJTxSQQDywdxqdDIITKG",
"id": 40,
"uid": "6lxYbX20ydo3qzfFP21xnH",
"name": "Notification1",
"conditions": {
"zone_severity_level": 2,
"alarm_type_list": ["buffer_violation"]
},
"active": 1,
"types": {
"email": false,
"phone": true
},
"created_at": "2018-03-31T11:14:49.236Z",
"updated_at": "2018-04-18T20:01:34.411Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notification_type": "ALARM"
},
{
"project_uid": "HuGJTxSQQDywdxqdDIITKG",
"id": 34,
"uid": "Snp9twNGXXzya0CUlK30pN",
"name": "Notification2",
"conditions": {
"zone_severity_level": 4,
"alarm_type_list": ["zone_violation"]
},
"active": 0,
"types": {
"email": true,
"phone": true
},
"created_at": "2018-03-06T20:11:37.804Z",
"updated_at": "2018-04-18T20:00:40.911Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notification_type": "ALARM"
}
]
}
Get single notification
GET api/notifications/{uid}
Get a single notification profile with a specified notification UID. To retrieve a notification UID, see get notifications.
Response Fields
| Field | Description |
|---|---|
| project_uid | The unique identifier of the project. |
| id | The identifier of the notification profile in the context of the server. |
| uid | The unique identifier of the notification profile. |
| name | The user-defined name of the notification profile. |
| conditions | A JSON object with information about the conditions of the notification profile. |
| conditions.zone_severity_level | The user-defined zone violation severity level condition of the notification profile. A notification is generated for every zone violation alarm with the specified severity level and higher. For more information on zone violation severity levels, see Zones API. |
| conditions.alarm_type_list | Alarm type for triggering alarm |
| active | Whether the notification profile is active. Inactive notification profiles do not generate notifications. |
| types | A JSON object with information about the method that notifications are sent to subscribers subscribed to the notification profile. |
| types.email | Whether the subscribers to the notification profile can receive notifications via email. |
| types.phone | Whether the subscribers to the notification profile can receive notifications via SMS message. |
| created_at | The UTC time stamp of when the notification profile was created. |
| updated_at | The UTC time stamp of when the notification profile was last updated. |
| removed_at | The UTC time stamp of when the notification profile was deleted, if it was. |
| notification_type | The type of notification. There are two types of notification profiles:
|
Example Response
{
"notifications": [
{
"project_uid": "HuGJTxSQQDywdxqdDIITKG",
"id": 40,
"uid": "6lxYbX20ydo3qzfFP21xnH",
"name": "Notification1",
"conditions": {
"zone_severity_level": 2,
"alarm_type_list": ["zone_violation"]
},
"active": 1,
"types": {
"email": false,
"phone": true
},
"created_at": "2018-03-31T11:14:49.236Z",
"updated_at": "2018-04-18T20:01:34.411Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notification_type": "ALARM"
}
]
}
Create notification
POST api/notifications
Create a notification profile that generates email or SMS notifications.
You can create two types of notification profiles:
- ALARM - Alarm notification profiles generate and send notifications when a zone violation alarm or an emergency call button alert is triggered.
- SYSTEM - System notification profiles generate and send notifications when a system event occurs. System events include WIN outages and server issues.
Request Fields
| Field | Required/Optional | Values | Type | Description |
|---|---|---|---|---|
| project_uid | optional | - | string | The unique identifier of the project. To retrieve a project UID, use GET api/projects described in Projects API. Note: If left empty, the response populates the UID of the project to which you have access. |
| name | required | - | string | The user-defined name of the notification profile. |
| conditions | - | - | object | A JSON object with information about the notification-generating conditions. |
| conditions.zone_severity_level | required | 0-4 | number | The user-defined zone violation severity level condition of the notification profile. A notification is generated for every zone violation alarm with the specified severity level and higher. For more information on zone violation severity levels, see Zones API. Note: This can only be configured for alarm type notifications. |
| conditions.alarm_type_list | optional |
|
array | Alarm type for triggering alarm if nothing selected mean set both type. |
| active | required |
|
boolean | Whether the notification profile is active. Inactive notification profiles do not generate email or SMS notifications. |
| types | - | - | object | A JSON object with information about the method that notifications are sent to subscribers subscribed to the notification profile. |
| types.email | required |
|
boolean | Whether the subscribers to the notification profile can receive notifications via email. |
| types.phone | required |
|
boolean | Whether the subscribers to the notification profile can receive notifications via SMS message. |
| notification_type | required |
|
string | The type of notification. |
Response Fields
| Field | Description |
|---|---|
| project_uid | The unique identifier of the project. |
| id | The identifier of the notification profile in the context of the server. |
| uid | The unique identifier of the notification profile. |
| name | The user-defined name of the notification profile. |
| conditions | A JSON object with information about the conditions of the notification profile. |
| conditions.zone_severity_level | The user-defined zone violation severity level condition of the notification profile. A notification is generated for every zone violation alarm with the specified severity level and higher. For more information on zone violation severity levels, see Zones API. |
| active | Whether the notification profile is active. Inactive notification profiles do not send notifications. |
| types | A JSON object with information about the method that notifications are sent to subscribers subscribed to the notification profile. |
| types.email | Whether the subscribers to the notification profile can receive notifications via email. |
| types.phone | Whether the subscribers to the notification profile can receive notifications via SMS message. |
| created_at | The UTC time stamp of when the notification profile was created. |
| updated_at | The UTC time stamp of when the notification profile was last updated. |
| removed_at | The UTC time stamp of when the notification profile was deleted, if it was. |
| notification_type | The type of notification. |
Example Request
{
"project_uid": "",
"name": "Notification1",
"conditions": {
"zone_severity_level": 0
},
"active": null,
"types": {
"email": true,
"phone": false
},
"notification_type": "ALARM"
}
Example Response
{
"project_uid": "scYt1aItltMOKsYwjJeN3A",
"id": 59,
"uid": "o8HPF3BBpEyWLqbx5CqB1c",
"name": "test",
"conditions": {
"zone_severity_level": 0
},
"active": 1,
"types": {
"email": true,
"phone": false
},
"created_at": "2018-06-07T17:54:27.517Z",
"updated_at": "2018-06-07T17:54:27.517Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notification_type": "ALARM"
}
Errors
| Error Status | Error Type | Error Body | Error Description |
|---|---|---|---|
| 422 | Unprocessable Entity | "message":"\"[field]\" is not allowed to be empty"} | A required field was left empty. |
| 422 | Unprocessable Entity | {"message":"\"[field]\" must be [format]"} | A field is in the incorrect format. |
Edit notification
PUT api/notifications/{uid}
Edit a notification profile with a specified notification UID. To retrieve a notification profile UID, see get notifications.
Request Fields
| Field | Required/Optional | Values | Type | Description |
|---|---|---|---|---|
| name | required | - | string | The name of the notification profile. |
| conditions | - | - | object | A JSON object with information about the conditions of the notification profile. |
| conditions.zone_severity_level | required | 0-4 | number | The user-defined zone violation severity level condition of the notification profile. A notification is generated for every zone violation alarm with the specified severity level and higher. For more information on zone violation severity levels, see Zones API. Note: This can only be configured for alarm type notifications. |
| conditions.alarm_type_list | optional |
|
array | Alarm type for triggering alarm if nothing selected mean set both type. |
| active | required |
|
boolean | Whether the notification profile is active. Inactive notification profiles do not generate notifications. |
| types | - | - | object | On profile. |
| types.email | required |
|
boolean | Whether the subscribers to the notification profile can receive notifications via email. |
| types.phone | required |
|
boolean | Whether the subscribers to the notification profile can receive notifications via SMS message. |
| notification_type | required |
|
string | The type of notification. |
Response Fields
| Field | Description |
|---|---|
| project_uid | The unique identifier of the project. |
| id | The identifier of the notification profile in the context of the server. |
| uid | The unique identifier of the notification profile. |
| name | The user-defined name of the notification profile. |
| conditions | A JSON object with information about the conditions of the notification profile. |
| conditions.zone_severity_level | The user-defined zone violation severity level condition of the notification profile. A notification is generated for every zone violation alarm with the specified severity level and higher. For more information on zone violation severity levels, see Zones API. |
| active | Whether the notification profile is active. Inactive notification profiles do not send notifications. |
| types | A JSON object with information about the method that notifications are sent to subscribers subscribed to the notification profile. |
| types.email | Whether the subscribers to the notification profile can receive notifications via email. |
| types.phone | Whether the subscribers to the notification profile can receive notifications via SMS message. |
| created_at | The UTC time stamp of when the notification profile was created. |
| updated_at | The UTC time stamp of when the notification profile was last updated. |
| removed_at | The UTC time stamp of when the notification profile was deleted, if it was. |
| notification_type | The type of notification. |
Example Request
Using PUT api/notifications/0E7ARYuRl51YyHbKQJ5fZK:
{
"name": "Notification1",
"conditions": {
"zone_severity_level": 1
},
"active": 1,
"types": {
"email": false,
"phone": true
},
"notification_type": "SYSTEM"
}
Example Response
{
"project_uid": "scYt1aItltMOKsYwjJeN3A",
"id": 62,
"uid": "0E7ARYuRl51YyHbKQJ5fZK",
"name": "Notification1",
"conditions": {
"zone_severity_level": 1,
"alarm_type_list": ["zone_violation", "buffer_violation"]
},
"active": 1,
"types": {
"email": false,
"phone": true
},
"created_at": "2018-06-07T18:07:04.643Z",
"updated_at": "2018-06-07T18:07:04.643Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notification_type": "SYSTEM"
}
Delete notification
DELETE api/notifications/{uid}
Deletes a notification profile with a specified notification UID. To retrieve a notification profile UID, see get notifications.
All requests return a status of 200.
Notification types
GET api/notification_types
Get server core and addon notification types.
Response fields
| Field | Description |
|---|---|
| notification_types | List of notification types |
Response values
| Value | Description |
|---|---|
| zone_violation | Notify about trackable violate some regular zone |
| buffer_violation | Notify about trackable violate some buffer zone |
| node_low_battery | Notify about trackable have low battery, require to charge tag |
| trackable_unresponsive | Notify about trackable has leave the facility** |
** Addon rtls-addon-attendance-detection is required
Response without addons
{
"notification_types": [
"zone_violation",
"buffer_violation",
"node_low_battery"
]
}
Response with addon rtls-addon-attendance-detection
{
"notification_types": [
"zone_violation",
"buffer_violation",
"node_low_battery",
"trackable_unresponsive"
]
}
Get subscribers
GET api/subscribers
Gets all subscribers associated with your project. Subscribers can be assigned to a notification profile to receive notifications. Subscribers are associated with an email address and/or a mobile phone number and can receive email or SMS-based notifications.
Note: Subscribers created through the Subscribers API can be subscribed to alarm-type notifications only. To assign a user to receive system-type notifications, edit a site using the Locations API. To subscribe a user to system-type notifications, use PUT api/locations/{uid} to edit the user_params.notifications field to include the user's email address.
Response Fields
| Field | Description |
|---|---|
| id | The identifier of the subscriber in the context of the server. |
| uid | The unique identifier of the subscriber. |
| name | The name of the subscriber. |
| addresses | A JSON object with information about the subscriber's email address and mobile phone number. |
| addresses.email | The email address of the subscriber. |
| addresses.phone | The mobile phone number of the subscriber. |
| created_at | The UTC time stamp of when the subscriber was created. |
| updated_at | The UTC time stamp of when the subscriber was last updated. |
| removed_at | The UTC time stamp of when the subscriber was deleted. |
| notifications | A JSON array of the notification profiles to which the subscriber is subscribed. |
| project_uid | The unique identifier of the project. |
Example Response
{
"subscribers": [
{
"id": 70,
"uid": "scYt1aItltMOKsYwjJeN3A",
"name": "Subscriber1",
"addresses": {
"email": "user@example.com"
},
"created_at": "2018-04-18T19:58:53.553Z",
"updated_at": "2018-04-18T19:58:53.553Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notifications": [],
"project_uid": "0E7ARYuRl51YyHbKQJ5fZK"
},
{
"id": 56,
"uid": "o8HPF3BBpEyWLqbx5CqB1c",
"name": "Subscriber2",
"addresses": {
"phone": "12345678912",
"email": "user@example2.com"
},
"created_at": "2018-03-29T14:15:02.713Z",
"updated_at": "2018-04-18T19:57:38.336Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notifications": [],
"project_uid": "0E7ARYuRl51YyHbKQJ5fZK"
}
]
}
Get single subscriber
`GET api/subscribers/{uid}"
Get a single subscriber with a specified subscriber UID. To retrieve a subscriber UID, see get subscribers.
Subscribers can be assigned to an alarm notification profile to receive notifications. Subscribers are associated with an email address and/or a mobile phone number and can receive email or SMS-based notifications.
Note: Subscribers created through the Subscribers API can be subscribed to alarm-type notifications only. To assign a user to receive system-type notifications, edit a site using the Locations API. To subscribe a user to system-type notifications, use PUT api/locations/{uid} to edit the user_params.notifications field to include the user's email address.
Response Fields
| Field | Description |
|---|---|
| id | The identifier of the subscriber in the context of the server. |
| uid | The unique identifier of the subscriber. |
| name | The name of the subscriber. |
| addresses | A JSON object with information about the subscriber's email address and mobile phone number. |
| addresses.email | The email address of the subscriber. |
| addresses.phone | The mobile phone number of the subscriber. |
| created_at | The UTC time stamp of when the subscriber was created. |
| updated_at | The UTC time stamp of when the subscriber was last updated. |
| removed_at | The UTC time stamp of when the subscriber was deleted. |
| notifications | A JSON array of the notification profiles to which the subscriber is subscribed. |
| project_uid | The unique identifier of the project. |
Example Response
Using GET api/subscribers/scYt1aItltMOKsYwjJeN3A:
{
"subscribers": [
{
"id": 70,
"uid": "scYt1aItltMOKsYwjJeN3A",
"name": "Subscriber1",
"addresses": {
"email": "user@example.com"
},
"created_at": "2018-04-18T19:58:53.553Z",
"updated_at": "2018-04-18T19:58:53.553Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notifications": [],
"project_uid": "0E7ARYuRl51YyHbKQJ5fZK"
}
]
}
Create subscriber
POST api/subscribers
Create a new subscriber and assign it to a notification profile.
Subscribers can be assigned to a notification profile to receive notifications. Subscribers are associated with an email address and/or a mobile phone number and can receive email or SMS-based notifications.
Note: Subscribers created through the Subscribers API can be subscribed to alarm-type notifications only. To assign a user to receive system-type notifications, edit a site using the Locations API. To subscribe a user to system-type notifications, use PUT api/locations/{uid} to edit the user_params.notifications field to include the user's email address.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| name | required | string | The name of the subscriber. |
| addresses | - | object | A JSON object with information about the subscriber's email address and mobile phone number. |
| addresses.email | required | string | The email address of the subscriber. |
| addresses.phone | required | string | The mobile phone number of the subscriber. |
| notifications | optional | string | An array of notification profile unique identifiers to which the subscriber is subscribed. To retrieve a notification profile UID, see get notifications. |
| project_uid | optional | string | The unique identifier of the project. |
Response Fields
| Field | Description |
|---|---|
| id | The identifier of the subscriber in the context of the server. |
| uid | The unique identifier of the subscriber. |
| name | The name of the subscriber. |
| addresses | A JSON object with information about the subscriber's email address and mobile phone number. |
| addresses.email | The email address of the subscriber. |
| addresses.phone | The mobile phone number of the subscriber. |
| created_at | The UTC time stamp of when the subscriber was created. |
| updated_at | The UTC time stamp of when the subscriber was last updated. |
| removed_at | The UTC time stamp of when the subscriber was deleted. |
| notifications | A JSON array of the notification profiles to which the subscriber is subscribed. |
| project_uid | The unique identifier of the project. |
Example Request
{
"name": "Subscriber",
"addresses": {
"email": "user@example.com"
},
"notifications": ["05xCyfPESsiYn0sPJyI4xA"],
"project_uid": ""
}
Example Response
{
"id": 70,
"uid": "scYt1aItltMOKsYwjJeN3A",
"name": "Subscriber",
"addresses": {
"email": "user@example.com"
},
"created_at": "2018-04-18T19:58:53.553Z",
"updated_at": "2018-04-18T19:58:53.553Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notifications": [
"05xCyfPESsiYn0sPJyI4xA"
],
"project_uid": "0E7ARYuRl51YyHbKQJ5fZK"
}
Edit subscriber
PUT api/subscribers/{uid}
Edit a subscriber with a specified subscriber UID. To retrieve a subscriber UID, see get subscribers.
Subscribers can be assigned to a notification profile to receive notifications. Subscribers are associated with an email address and/or a mobile phone number and can receive email or SMS-based notifications.
Note: Subscribers created through the Subscribers API can be subscribed to alarm-type notifications only. To assign a user to receive system-type notifications, edit a site using the Locations API. To subscribe a user to system-type notifications, use PUT api/locations/{uid} to edit the user_params.notifications field to include the user's email address.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| name | required | string | The name of the subscriber. |
| addresses | - | object | A JSON object with information about the subscriber's email address and mobile phone number. |
| addresses.email | required | string | The email address of the subscriber. |
| addresses.phone | required | string | The mobile phone number of the subscriber. |
| notifications | optional | string | An array of notification profile unique identifiers to which the subscriber is subscribed. To retrieve a notification profile UID, see get notifications. |
| project_uid | optional | string | The unique identifier of the project. |
Response Fields
| Field | Description |
|---|---|
| id | The identifier of the subscriber in the context of the server. |
| uid | The unique identifier of the subscriber. |
| name | The name of the subscriber. |
| addresses | A JSON object with information about the subscriber's email address and mobile phone number. |
| addresses.email | The email address of the subscriber. |
| addresses.phone | The mobile phone number of the subscriber. |
| created_at | The UTC time stamp of when the subscriber was created. |
| updated_at | The UTC time stamp of when the subscriber was last updated. |
| removed_at | The UTC time stamp of when the subscriber was deleted. |
| notifications | A JSON array of the notification profiles to which the subscriber is subscribed. |
| project_uid | The unique identifier of the project. |
Example Request
Using PUT api/subscribers/scYt1aItltMOKsYwjJeN3A:
{
"name": "Subscriber",
"addresses": {
"email": "user@example.com"
},
"notifications": ["05xCyfPESsiYn0sPJyI4xA"],
"project_uid": ""
}
Example Response
{
"id": 70,
"uid": "scYt1aItltMOKsYwjJeN3A",
"name": "Subscriber",
"addresses": {
"email": "user@example.com"
},
"created_at": "2018-04-18T19:58:53.553Z",
"updated_at": "2018-04-18T19:58:53.553Z",
"removed_at": "9999-12-31T23:59:59.000Z",
"notifications": [
"05xCyfPESsiYn0sPJyI4xA"
],
"project_uid": "0E7ARYuRl51YyHbKQJ5fZK"
}
Delete subscriber
DELETE api/subscribers/{uid}
Delete a subscriber with a specified subscriber UID. To retrieve a subscriber UID, see get subscribers.
All requests return a response with status 200.