CloudServices/Notifications/Specification/POSTOffice: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
The POST Office supports a very simple REST API allowing web apps to send notifications to a subscription token.
The POST Office supports a very simple REST API, allowing web apps to send notifications to a subscription token.


= Web App Sends Notification =
= Web App Sends Notification =

Revision as of 20:49, 14 April 2011

The POST Office supports a very simple REST API, allowing web apps to send notifications to a subscription token.

Web App Sends Notification

  1. Web app sends notification to POST Office.
    W: POST /1.0/notification HTTP/1.1
    W:
    W: {
         "body":"{\"token\":\"T in Base 64\",...",
         "HMAC":"BASE64=="
       }
    P: HTTP/1.1 202 ACCEPTED
    
  2. Body is a JSON serialization of
    { 
      "token": "T in Base 64",
      "timestamp": ######## (in seconds UTC), // Optional,
      "ttl": ######## (in seconds), // Optional
      "ciphertext": "BASE64==",
      "IV": "BASE64==",
    }
    
  3. Ciphertext is a JSON serialization encrypted with the encryption key using AES-256-CBC and base-64 encoded. The contents of the payload differ based on the type of message. For example, the payload of a standard notification will look like the following:
    {
      "type":"notification",
      "title":"...",
      "body":"...",
      "url":"http://foobar.com"
    }