Notifications¶
Using this part of the API you can retrieve information about user’s notifications and mark them as read. These capabilities correspond to the Notifications page in the Energomonitor application.
Objects¶
Notification¶
The notification object describes a notification.
Example¶
{
"id": 64810,
"title": "'Energomonitor HQ' homebase doesn't send data.",
"content": "We just found out that your Homebase is not connected to our servers.",
"feed_title": "Energomonitor HQ",
"created_at": "2017-04-13T08:32:16+00:00",
"read": true,
"archived": false
}
Properties¶
Name |
Type |
Description |
---|---|---|
|
|
Notification ID. It uniquely identifies the notification within the system. |
|
|
Title of the notification. |
|
|
Content of the notification, in HTML format. It is usually a long, multi-line text. |
|
|
Title of the feed the notification is related to. |
|
|
Time when the notification was created, in ISO 8601 format. |
|
|
Indicates whether the notification was read. |
|
|
Indicates whether the notitication was archived. |
Resources¶
GET /users/{user_id}/notifications¶
Lists user’s notifications. Returns an array of notification objects.
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
Only list notifications created at or after this time, in ISO 8601 format. |
Example response¶
[
{
"id": 64810,
"title": "'Energomonitor HQ' homebase doesn't send data.",
"content": "We just found out that your Homebase is not connected to our servers.",
"feed_title": "Energomonitor HQ",
"created_at": "2017-04-13T08:32:16+00:00",
"read": true,
"archived": false
}
]
PATCH /users/{user_id}/notifications¶
Modifies user’s notifications. Returns a response with 205
HTTP status
code and an empty body.
The request must contain an object with one or more of the following properties (their semantics is the same as in a notification object):
read
archived
Example request¶
{
"read": true
}
GET /users/{user_id}/notifications/{id}¶
Retrieves a single notification. Returns a notification object.
Example response¶
{
"id": 64810,
"title": "'Energomonitor HQ' homebase doesn't send data.",
"content": "We just found out that your Homebase is not connected to our servers.",
"feed_title": "Energomonitor HQ",
"created_at": "2017-04-13T08:32:16+00:00",
"read": true,
"archived": false
}
PATCH /users/{user_id}/notifications/{id}¶
Modifies a single notification. Returns a notification object.
The request must contain an object with one or more of the following properties (their semantics is the same as in a notification object):
read
archived
Example request¶
{
"read": true
}
Example response¶
{
"id": 64810,
"title": "'Energomonitor HQ' homebase doesn't send data.",
"content": "We just found out that your Homebase is not connected to our servers.",
"feed_title": "Energomonitor HQ",
"created_at": "2017-04-13T08:32:16+00:00",
"read": true,
"archived": false
}
GET /users/{user_id}/notification_count¶
Retrieves notification count information. Returns an object with the following properties:
Name |
Type |
Description |
---|---|---|
|
|
Number of read notifications. |
|
|
Number of unread notifications. |
|
|
Number of archived notifications. |
|
|
Number of unarchived notifications. |
|
|
Total number of notifications. |
Example response¶
{
"read": 170,
"unread": 2,
"archived": 100,
"unarchived": 72,
"total": 172
}