Confirmed users
1,018
edits
Line 131: | Line 131: | ||
== Server API == | == Server API == | ||
Push Notification Messages are sent to the <tt>url</tt> returned by the Client API <tt>requestURL()</tt> response (<i>NotificationURL</i>). Notification content consist of a JSON block POSTed to the <i>NotificationURL</i> | |||
=== Notification JSON Content === | |||
The Push Notification JSON block consists of the following: | |||
* '''messageType''': "notification". <b>Mandatory</b> | |||
* '''message''': Main body. This could contain a maximum of 1024 bytes. Can be anything that fits in UTF8. <b>Mandatory</b> | |||
* '''signature''': The text message signed with the Private Key that is verified and, if fails, the notification is thrown away and not accepted. <b>Mandatory</b> | |||
* '''id''': a server side generated id to identify the notification. <i>Optional</i>. | |||
* '''ttl''': Maximum time of live of the notification. The server will discard any notification in a maximum time or in the ttl time, whatever first occurs. <i>Optional</i>. | |||
* '''timestamp''': Time when the notification was sent. <i>Optional</i>. | |||
* '''priority''': A priority value, from 1 to 4. 1 should be delivered instantly, and 4 will be delivered at the servers discretion. <i>Optional</i> | |||
=== Response === | |||
HTTP Status Codes in response: | HTTP Status Codes in response: | ||
Line 147: | Line 150: | ||
* '''400''': Notification rejected. | * '''400''': Notification rejected. | ||
==== Error Response Body ==== | |||
When the notification is rejected, the NotificationURL server will return a JSON block with the following content: | |||
* '''status''': 'ERROR' | |||
* '''reason''': Reason the Status post failed to be handled. <i>Optional</i> |