Labs/Bespin/ServerAPI: Difference between revisions

no edit summary
No edit summary
Line 28: Line 28:
* GET /file/at/[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/at/[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/at/[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.
* PUT /file/at/[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/at/[path] to delete a file. file must not be open by anyone except the owner.  
* DELETE /file/at/[path] to delete a file. file must not be open by anyone except the user doing the deletion.  
* POST /file/close/[path] to mark the file closed. The server will discard your edit history.  
* POST /file/close/[path] to mark the file closed. The server will discard your edit history.  
* GET /file/listopen/ to list open files for the current user. a JSON dictionary of <tt>{ project: { name: filename,  mode: r|rw } }</tt> will be returned. For example, if subdir1/subdir2/test.py is open read/write, openfiles will return <tt>{ "subdir1": { name: "somedir2/test.py", mode: "rw" } }</tt>
* GET /file/listopen/ to list open files for the current user. a JSON dictionary of <tt>{ project: { name: filename,  mode: r|rw } }</tt> will be returned. For example, if subdir1/subdir2/test.py is open read/write, openfiles will return <tt>{ "subdir1": { name: "somedir2/test.py", mode: "rw" } }</tt>
Line 36: Line 36:


* GET /project/info/[projectname]/ - returns a JSON dictionary with "owner" and "members" (the people authorized to work on the project)
* GET /project/info/[projectname]/ - returns a JSON dictionary with "owner" and "members" (the people authorized to work on the project)
* POST /project/rename/[projectname]/ - the body of the request is the new project name.
* POST /project/authorized/[projectname]/[username] - authorize username to access the project (only the project owner can do this)
* POST /project/authorized/[projectname]/[username] - authorize username to access the project (only the project owner can do this)
* DELETE /project/authorized/[projectname]/[username] - remove username's access to the project (only the project owner can do this)
* DELETE /project/authorized/[projectname]/[username] - remove username's access to the project (only the project owner can do this)
canmove, Confirmed users, Bureaucrats and Sysops emeriti
1,093

edits