notifications endpoints - fullphat/snarl_network_protocol GitHub Wiki
These endpoints allow applications to create and remove notifications.
-
POST
/notifications[/{AppId}[/{EventId}]]
: Displays a notification -
DELETE
/notifications[/{AppId}[/{Uid}]]
: Removes a notification from the screen
-
GET
requests do not require authentication -
POST
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.
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.
If a password was specified when the application was registered, the same password must be included in the oxide-password
header of the request.
Must be a NotificationContent
objects that contains details of the notification.
Code | Likely cause |
---|---|
Created |
The notification was created successfully. |
- 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.
The following creates a simple notification using application 'Foo' and event 'Bar':
POST /v2/notifications/foo/bar
{
"title":"Hello, world!",
"text":"Just a test...",
"icon":"!misc-chair",
}
{
"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"
}
}