Labs/Bespin/ServerAPI: Difference between revisions

From MozillaWiki
< Labs‎ | Bespin
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
* GET /edit/recent/N/[path] gives a JSON list of edit actions, starting after N. edit/recent/1 would skip the first entry.  
* 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.)
* 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.)
* GET /edit/reset/ blows away all edits
* GET /edit/reset/[path] blows away edits for a specific path
* 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)
* 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 18:02, 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.)
  • GET /edit/reset/ blows away all edits
  • GET /edit/reset/[path] blows away edits for a specific path
  • 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)