WebAPI/SimplePush: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 139: Line 139:
=== API ===
=== API ===
* Requests from UserAgent to PushServer MUST provide a PushServer Generated UserAgentID (UAID) as the "X-UserAgent-ID" header.
* Requests from UserAgent to PushServer MUST provide a PushServer Generated UserAgentID (UAID) as the "X-UserAgent-ID" header.
* All requests and responses '''MUST''' include a <tt>digest</tt> field which is a SHA1 checksum of known channelIDs at the sender. This should be calculated from the state of the persistent database. If a mismatch occurs, it is resolved using the Registration Sync Protocol.
Digest calculation:
** <tt>channels</tt> = Sort channelIDs by lexicographically increasing order as '''strings'''
** <tt>str</tt> - Join sorted channelIDs using a '''comma''' (,)
** <tt>digest</tt> = SHA1(tt)
'''NOTE:''' Digest inconsistency will occur during /register and /unregister. This should NOT be considered as a state mismatch.
* UserAgent requests may include a /{network} prefix to indicate a request may be handled by a third party network (e.g. <code>GET http:<i>host</i>/foonet/update</code> will return update requests for elements provided by the "foonet" sub-provider. '''TODO: The semantics of this are woefully lacking in the current state of the protocol'''
* UserAgent requests may include a /{network} prefix to indicate a request may be handled by a third party network (e.g. <code>GET http:<i>host</i>/foonet/update</code> will return update requests for elements provided by the "foonet" sub-provider. '''TODO: The semantics of this are woefully lacking in the current state of the protocol'''
* Calls will return standard HTTP status headers.  
* Calls will return standard HTTP status headers.  
Line 193: Line 187:
===== Returns =====
===== Returns =====


On success, this returns the new digest on the server side.
On success, this returns an empty JSON object
  {"digest": "checksum192"}
  {}


===== Errors =====
===== Errors =====
Line 233: Line 227:
  GET http://push.m.o/v1/update
  GET http://push.m.o/v1/update
  ---
  ---
  {"digest": "hash string",
  {"updates": [{"channelID":"1ced595d7f6c9f60cc5c9395dc6b72aa7e1a69a7","version":"42"},
  "updates": [{"channelID":"1ced595d7f6c9f60cc5c9395dc6b72aa7e1a69a7","version":"42"},
               {"channelID":"bf08e25861c900c3ab343670eee1873d0b724eef","version":"1"}],
               {"channelID":"bf08e25861c900c3ab343670eee1873d0b724eef","version":"1"}],
   "expired": ["channelID1", "channelID2", ...]}
   "expired": ["channelID1", "channelID2", ...]}
Line 273: Line 266:
</pre>
</pre>
<pre class="_fck_mw_lspace">---
<pre class="_fck_mw_lspace">---
{"digest": "..."}
{}
</pre>
</pre>


Confirmed users
93

edits

Navigation menu