Labs/Bespin/ServerAPI: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 20: Line 20:
* GET /edit/reset/[path] blows away edits for a specific path
* 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)
== Files ==
* 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.
* 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.
* 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.
* GET /file/open/ to list open files. a JSON dictionary of {filename: {mode: [user names]}} will be returned. For example, if subdir1/subdir2/test.py is open readonly by bgalbs and read/write by jbellis, openfiles will return {"subdir1/subdir2/test.py": {"r": ["bgalbs"], "rw": ["jbellis"]}}
123

edits

Navigation menu