Cloud Notify API Docs

Authentication #

Authentication is done using token/bearer auth. To generage a new API key, simply log into the web app and create a new key in the API Keys section. Then send it in your request headers in the form:

Authorization: Bearer YOUR_API_KEY

POST /api/v1/request #

Create a new alert for a specific device

Endpoint URL

https://cloudnotify.co.uk/api/v1/request

Query parameters

Name Type Description
device_uuid

Optional

string, array, null Where should we send the alert? The device UUID is displayed on the Device management web app page. To send a request to a single device, specify device_uuid as a string. To send a request to multiple devices, send multiple device_uuid strings in an array. To send to all your devices either don't specify device_uuid or send an empy list, string or null.
message

Optional

string, null An optional message, maybe you want a little more detail about the alart? This fields is displayed in both notifications and alarms.
notification_type Optional integer, null What type of alert do we want? 0 == notification, 1 == alarm. Default value is notification.
request_priority

Optional

string, null Firebase Cloud Messaging priority. Valid values are "normal" and "high". More detail can be found here. Default value is "high".
title

Optional

string, null Title for the alert. Default value is "Test <notification_type> This fields is displayed in both notifications and alarms.
user_priority

Optional

integer, null A simple way to flag the importance of an alart in the UI. Valid values are 0 == none, 1 == low, 2 = medium, 3 == high. Default value is 0.
unique_id

Optional

string max length 100 Used with alert_on_count to group multiple requests by device_uuid into a single alert. If multiple API requests with the same unique_id are received you will only receive an alert when a value in the alert_on_count array is reached.
alert_on_count

Optional

array of integers > 0 Used with unique_id. if multiple API requests are received with the same unique_id you will only receive an alert when a value in the alert_on_count array is reached. NOTE: each device_uuid will have a different request.

Example request

curl -X POST https://cloudnotify.co.uk/api/v1/request -H "Content-Type: application/json" -H "Authorization: Bearer s0Rwvm-aWZi-lcWxQH57hVE1QmqLqcjA-c8_TkxrbAaqQEy2Fg" -d '{"device_uuid": "547343a9-b42e-4c65-9077-63c060071ba2", "title": "My first alert"}'

Example response

                    [
                        {
                            "alert_on_count": [],
                            "created":1607872335066.742,
                            "device_ack":null,
                            "device_uuid":"547343a9-b42e-4c65-9077-63c060071ba2",
                            "is_deleted":false,
                            "message":null,
                            "notification_type":0,
                            "request_count": 1,
                            "request_priority":"high",
                            "response_code":200,
                            "response_message":"projects/cloud-notify-e3f2d/messages/0:1607872335269101%8c22dedcf9fd7ecd",
                            "self_link":"https://cloudnotify.co.uk/api/v1/request/824b7b81-eaec-4fe2-b1d8-22348a932450",
                            "title":"My first alert",
                            "unique_id": null,
                            "user":"c56ab970-e3da-4a5b-aded-7d802b31c587",
                            "user_ack":null,
                            "user_priority":0,
                            "uuid":"824b7b81-eaec-4fe2-b1d8-22348a932450"
                        }
                    ]
                

Response fields

Name Type Description
alert_on_count array of integers > 0 Used with unique_id. if multiple API requests are received with the same unique_id you will only receive an alert when a value in the alert_on_count is reached.
created string Epoch in milliseconds the request was created.
device_ack string, null When/if the device has acknowledged the alert. A timestamp in the form %Y-%m-%dT%H:%M:%S%z.
device_uuid string Where was the alert sent? The device UUID is displayed on the Device management web app page.
is_deleted boolean Used by the server.
message string, null An optional message.
notification_type integer What type of alert do we want? 0 == notification, 1 == alarm.
request_count integer Number of times we have seen this request with it's unique_id. If not using unique_id it will default to 1.
request_priority string Firebase Cloud Messaging priority. Valid values are "normal" and "high". More detail can be found here. Default value is "high".
response_code integer Firebase Cloud Messaging response code. 200 == success
response_message string Firebase Cloud Messaging response message.
self_link string A self link to this request. We can use this to get updates
title string Title for the alert. This fields is displayed in both notifications and alarms.
unique_id string max length 100 Used with alert_on_count to group multiple requests into a single alert. If multiple API requests with the same unique_id are received you will only receive an alert when alert_on_count is reached.
user string The user that send the request.
user_ack number, null When/if the user has acknowledged the alert. A timestamp in the form %Y-%m-%dT%H:%M:%S%z.
user_priority integer A simple way to flag the importance of an alart in the UI. Valid values are 0 = none, 1 = low, 2 = medium, 3 = high. Default value is 0.
uuid string Request UUID.

GET /api/v1/request/{request_uuid}; #

Get the latest data for an existing request

Endpoint URL

https://cloudnotify.co.uk/api/v1/request/{request_uuid}

Example request

curl -X GET https://cloudnotify.co.uk/api/v1/request/824b7b81-eaec-4fe2-b1d8-22348a932450 -H "Content-Type: application/json" -H "Authorization: Bearer s0Rwvm-aWZi-lcWxQH57hVE1QmqLqcjA-c8_TkxrbAaqQEy2Fg"

Example response

                    {
                        "alert_on_count": [],
                        "created":1607872335066.742,
                        "device_ack":"2020-12-13T15:12:16+0000",
                        "device_uuid":"547343a9-b42e-4c65-9077-63c060071ba2",
                        "is_deleted":false,
                        "message":null,
                        "notification_type":0,
                        "request_count": 1,
                        "request_priority":"high",
                        "response_code":200,
                        "response_message":"projects/cloud-notify-e3f2d/messages/0:1607872335269101%8c22dedcf9fd7ecd",
                        "self_link":"https://cloudnotify.co.uk/api/v1/request/824b7b81-eaec-4fe2-b1d8-22348a932450",
                        "title":"Test notification",
                        "unique_id": null,
                        "user":"c56ab970-e3da-4a5b-aded-7d802b31c587",
                        "user_ack":"2020-12-13T16:48:25+0000",
                        "user_priority":0,
                        "uuid":"824b7b81-eaec-4fe2-b1d8-22348a932450"
                    }
                

Response fields

Name Type Description
alert_on_count array of integers > 0 Used with unique_id. if multiple API requests are received with the same unique_id you will only receive an alert when a value in the alert_on_count is reached.
created string Epoch in milliseconds the request was created.
device_ack string, null When/if the device has acknowledged the alert. A timestamp in the form %Y-%m-%dT%H:%M:%S%z.
device_uuid string Where was the alert sent? The device UUID is displayed on the Device management web app page.
is_deleted boolean Used by the server.
message string, null An optional message.
notification_type integer What type of alert do we want? 0 == notification, 1 == alarm.
request_count integer Number of times we have seen this request with it's unique_id. If not using unique_id it will default to 1.
request_priority string Firebase Cloud Messaging priority. Valid values are "normal" and "high". More detail can be found here. Default value is "high".
response_code integer Firebase Cloud Messaging response code. 200 == success
response_message string Firebase Cloud Messaging response message.
self_link string A self link to this request. We can use this to get updates
title string Title for the alert. This fields is displayed in both notifications and alarms.
unique_id string max length 100 Used with alert_on_count to group multiple requests into a single alert. If multiple API requests with the same unique_id are received you will only receive an alert when alert_on_count is reached.
user string The user that send the request.
user_ack number, null When/if the user has acknowledged the alert. A timestamp in the form %Y-%m-%dT%H:%M:%S%z.
user_priority integer A simple way to flag the importance of an alart in the UI. Valid values are 0 = none, 1 = low, 2 = medium, 3 = high. Default value is 0.
uuid string Request UUID.

Cloud Notify CLI #

A BIG thank you to Jamie for his time and effort in creating this Command Line Interface.


“Everything should be made as simple as possible, but not simpler.” - Albert Einstein