Labs/Bespin/ServerAPI: Difference between revisions

From MozillaWiki
< Labs‎ | Bespin
Jump to navigation Jump to search
(New page: This aims to document the Bespin server API. It is taken from the original Python prototype server and has been updated for the subsequent Java server. == Errors == * "You're not logged ...)
 
No edit summary
Line 4: Line 4:


* "You're not logged in, and this request requires you to be" errors will be HTTP 401 status codes  
* "You're not logged in, and this request requires you to be" errors will be HTTP 401 status codes  
* Other errors will be HTTP 400, with an explanation string  
* Other errors will be HTTP 400 (Bad Request), 404 (Not Found), 500 (Internal Error), or 501 (Not Implemented) with an explanation string  


== Authentication ==
== Authentication ==
Line 11: Line 11:
* POST (or GET) /register/logout/  
* POST (or GET) /register/logout/  
* GET /register/ for debugging, it will tell you who it thinks you are logged in as
* GET /register/ for debugging, it will tell you who it thinks you are logged in as
== Editing ==
* GET /edit/list/[path] gives a JSON list of edit actions from the last save to the current edit pointer.
* GET /edit/recent/N/[path] gives a JSON list of edit actions, starting after N. edit/recent/1 would skip the first entry.
* PUT /edit/[path], with the serialized JSON object representing the action as the PUT body. (you can start sending do's before your first save.)
* edit queue is wiped when file is saved. (otherwise someone GETting the file and edits has no way of knowing the original state of the file from which to start applying edit actions)

Revision as of 17:20, 19 December 2008

This aims to document the Bespin server API. It is taken from the original Python prototype server and has been updated for the subsequent Java server.

Errors

  • "You're not logged in, and this request requires you to be" errors will be HTTP 401 status codes
  • Other errors will be HTTP 400 (Bad Request), 404 (Not Found), 500 (Internal Error), or 501 (Not Implemented) with an explanation string

Authentication

  • POST (or GET) /register/login/username -- no password necessary
  • POST (or GET) /register/logout/
  • GET /register/ for debugging, it will tell you who it thinks you are logged in as

Editing

  • GET /edit/list/[path] gives a JSON list of edit actions from the last save to the current edit pointer.
  • GET /edit/recent/N/[path] gives a JSON list of edit actions, starting after N. edit/recent/1 would skip the first entry.
  • PUT /edit/[path], with the serialized JSON object representing the action as the PUT body. (you can start sending do's before your first save.)
  • edit queue is wiped when file is saved. (otherwise someone GETting the file and edits has no way of knowing the original state of the file from which to start applying edit actions)