canmove, Confirmed users, Bureaucrats and Sysops emeriti
1,093
edits
(→Files: removing GET as option for /file/close because of the edit loss) |
(→Files: disambiguate URLs by making file manipulations under /at/) |
||
Line 24: | Line 24: | ||
* 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/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/[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/[path] to delete a file. file must not be open by anyone. | * DELETE /file/at/[path] to delete a file. file must not be open by anyone. | ||
* 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: { filename: mode } }</tt> will be returned. For example, if subdir1/subdir2/test.py is open read/write, openfiles will return <tt>{ "subdir1": { "somedir2/test.py": "rw" } }</tt> | * GET /file/listopen/ to list open files for the current user. a JSON dictionary of <tt>{ project: { filename: mode } }</tt> will be returned. For example, if subdir1/subdir2/test.py is open read/write, openfiles will return <tt>{ "subdir1": { "somedir2/test.py": "rw" } }</tt> |