WebAPI/SimplePush: Difference between revisions

Jump to navigation Jump to search
Line 209: Line 209:


==== POST /v1/update ====
==== POST /v1/update ====
<p>Refresh the server from the client.
====== Registration Sync Protocol ======
</p><p>This request requires a X-UserAgent-ID header. If the UserAgent attempts to POST information to the server which already has data for that X-UserAgent-ID, the server will deny the request with a 403 error. In that case, the UserAgent should request re-registration for all Channels.  
Refresh the server from the client.
</p>
 
This request requires a X-UserAgent-ID header. If the UserAgent attempts to POST information to the server which already has data for that X-UserAgent-ID, the server will deny the request with a 403 error. In that case, the UserAgent should request re-registration for all Channels.  
 
The UserAgent '''SHOULD'''
a) Send a list of <channelID, version> pairs capturing its current state to PushServer, along with the UAID.
b) If the PushServer accepts the request, it SHOULD update its records. UserAgent and PushServer are now back in sync. DONE
c) If the PushServer detects a duplicate UAID, it SHOULD respond with an error.
d) In this case, the client should invalidate its current state and ask apps application to re-register using
  the <tt>push-register</tt> system message. UserAgent and PushServer will now organically sync similar to standard /register calls.


===== Arguments =====
===== Arguments =====
<p>The POST body is a JSON encoded block which matches the form and structure of the GET /v1/update/ request.
The POST body is a JSON encoded block:
</p>
<pre>
{
  "channels": [{"channelID1": "version1"}, {"channelID2": "version2"}, ...]
}
</pre>
 
===== Returns =====
===== Returns =====
<p>This will return an empty object.
 
</p>
{
  "digest": "..."
}
 
UserAgent should confirm match
 
===== Errors =====
 
* ReRegister - The server may response with this for any reason, although usually it'll be due to duplicate UAID.
 
===== Example =====
===== Example =====
<pre class="_fck_mw_lspace">POST http://push.m.o/v1/update
<pre class="_fck_mw_lspace">POST http://push.m.o/v1/update
Line 224: Line 246:
</pre>
</pre>
<pre class="_fck_mw_lspace">---
<pre class="_fck_mw_lspace">---
{}
{"digest": "..."}
</pre>
</pre>


Confirmed users
93

edits

Navigation menu