Notifications Endpoints - fullphat/snarl_network_protocol GitHub Wiki
Overview
These endpoints allow applications to create and remove notifications.
Contents
POST
/notifications[/{AppId}[/{EventId}]]
: Displays a notificationDELETE
/notifications[/{AppId}[/{Uid}]]
: Removes a notification from the screen
Notes
GET
requests do not require authenticationPOST
andDELETE
requests must include the application's password (if one was specified)GET
requests use the application's guid, which is assigned by Snarl when the application is first registered;POST
andDELETE
requests use the application's identifier, which is provided by the developer.
POST
/notifications[/{AppId}[/{EventId}]]
Displays a notification using {AppId}
and {EventId}
as the application and event identifiers respectively. If neither {AppId}
or {EventId}
are specified, the notification will be created using Snarl's anonymous notification's event class.
Authentication
If a password was specified when the application was registered, the same password must be included in the oxide-password
header of the request.
Request Body
Must be a NotificationContent
objects that contains details of the notification.
Response
Code | Likely cause |
---|---|
Created |
The notification was created successfully. |
Notes
- Using the Snarl anonymous notification event class is only recommended for testing purposes. In a production environment, it's likely the user (or system administrator) will disable these class.
- Receiving a
Created
response does not guarantee that the notification was actually displayed. For example, the user may have configured Snarl to re-route notifications of the specified class elsewhere, or the user may be away, or have Do Not Disturb mode enabled.
Example
The following creates a simple notification using application 'Foo' and event 'Bar':
Request
POST /v2/notifications/foo/bar
Body
{
"title":"Hello, world!",
"text":"Just a test...",
"icon":"!misc-chair",
}
Response
{
"Meta": {
"Code": 201,
"Text": "Created",
"Message": "",
"Timestamp": "2018-05-04T09:13:52.1049763+01:00",
"Host": "cs30",
"Platform": "Win32NT",
"PlatformVersion": "6.1.7601.65536"
},
"Data": {
"Guid": "79200e2f-aa43-4bb9-aab6-32fffa4e19bc"
}
}