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

id

integer

Notification ID. It uniquely identifies the notification within the system.

title

string

Title of the notification.

content

string

Content of the notification, in HTML format. It is usually a long, multi-line text.

feed_title

string

Title of the feed the notification is related to.

created_at

string

Time when the notification was created, in ISO 8601 format.

read

boolean

Indicates whether the notification was read.

archived

boolean

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

created_at_from

string

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

read

integer

Number of read notifications.

unread

integer

Number of unread notifications.

archived

integer

Number of archived notifications.

unarchived

integer

Number of unarchived notifications.

total

integer

Total number of notifications.

Example response

{
  "read": 170,
  "unread": 2,
  "archived": 100,
  "unarchived": 72,
  "total": 172
}