Labs/Bespin/ServerAPI: Difference between revisions

Line 25: Line 25:
* GET /file/list/[path] gives a JSON list of files in the directory given by [path]. Path is relative to the projects directory. Directories will have "/" appended to their name.
* GET /file/list/[path] gives a JSON list of files in the directory given by [path]. Path is relative to the projects directory. Directories will have "/" appended to their name.
* GET /file/[path]?mode=[r|rw] to get the contents of a file. (raw text, not a JSON string!) if the file does not exist, an empty body will be returned; use list to determine if a file actually exists. the server will record you as having the file open with the given mode after this call. If mode is not specified, rw is used.
* GET /file/[path]?mode=[r|rw] to get the contents of a file. (raw text, not a JSON string!) if the file does not exist, an empty body will be returned; use list to determine if a file actually exists. the server will record you as having the file open with the given mode after this call. If mode is not specified, rw is used.
* PUT /file/[path] to save a file, with the file contents as the PUT body. subdirectories will be created as needed. the file will NOT be marked closed until an explicit close call is made.
* PUT /file/[path]?lastEdit=[n] to save a file, with the file contents as the PUT body. subdirectories will be created as needed. If the lastEdit parameter is excluded, the request will only succeed if the file is *not* open for editing. Otherwise, the lastEdit parameter must include the number of the last edit received by the client at the time the save was requested.
* DELETE /file/[path] to delete a file. file must not be open by anyone.  
* DELETE /file/[path] to delete a file. file must not be open by anyone.  
* POST (or GET) /file/close/[path] to mark the file closed. The server will discard your edit history.  
* POST (or GET) /file/close/[path] to mark the file closed. The server will discard your edit history.  
123

edits