-
Notifications
You must be signed in to change notification settings - Fork 2
SNP 1
SNP 1 provides very basic access to the Snarl API. There are two variations: 1.0 and 1.1. SNP 1.0 was introduced in Snarl 2.0 and SNP 1.1 added further functionality in Snarl 2.3.
Development on SNP 1 has now ceased and both versions are considered deprecated, applications should be migrated to use SNP 2 wherever possible.
SNP 1 defines two types of message: a request and a response.
An SNP 1 request is a single line terminated by a \r\n pair. The request consists of one or more entries, separated using a #? pair of characters. Each entry is then split into a key/value pair using a single =, as follows:
key=value#?key=value#?key=value\r\n
Each entry must contain a key and value; valueless keys are not permitted. Case is also important, especially when it comes to key names and mandatory values. Each request must contain the following:
| Entry | Details |
|---|---|
type |
The type of request (always SNP) |
version |
The sub version number (either 1.0 or 1.1) |
action |
The action to perform |
For all actions other than version, the following must also be included:
| Entry | Details |
|---|---|
app |
The application the action refers to |
type=SNP#?version=1.1#?action=register#?app=My Cool App\r\n
An SNP 1 response is a single line of information separated by forward slashes:
SNP/{version}/{status code}/{status text}[/{data}]
The following indicates success with returned value of 404:
SNP/1.1/0/OK/404
(Snarl Net Cmd) is a small .net 2.0 command-line application that uses SNP 1.1 to communicate with Snarl.
Registers an application with Snarl. The same application cannot be registered twice – attempting to do so will result in an error.
| Entry | Details |
|---|---|
action |
Must be register
|
app |
Name of the application being registered |
type=SNP#?version=1.1#?action=register#?app=My Cool App\r\n
Adds an event class to a previously registered application.
| Entry | Details |
|---|---|
action |
Must be add_class
|
app |
Name of the application being registered |
class |
Name of the event class being added |
type=SNP#?version=1.1#?action=add_class#?app=My Cool App#?class=Event1\r\n
Generates a notification using a previously registered application and class.
| Entry | Details |
|---|---|
action |
Must be notification
|
app |
Name of the registered application |
class |
Name of the event class to use |
| Entry | Details |
|---|---|
title |
|
text |
|
timeout |
|
icon |
(SNP 1.1 only) |
default_ack |
(SNP 1.1 only) |
type=SNP#?version=1.1#?action=notification#?app=My Cool App#?class=Event1#?title=Some title#?text=Hello, world!
Removes the registration of an application from Snarl.
| Entry | Details |
|---|---|
action |
Must be unregister
|
app |
Name of the application being unregistered |
type=SNP#?version=1.1#?action=unregister#?app=My Cool App\r\n
Queries the version of Snarl running. If successful, returns the API version of Snarl.
| Entry | Details |
|---|---|
action |
Must be version
|
type=SNP#?version=1.1#?action=version
Snarl Wiki
Copyright © 2020 full phat products