Fossil SCM
| 85967b7… | stephan | 1 | # JSON API: /dir |
| 85967b7… | stephan | 2 | ([⬑JSON API Index](index.md)) |
| 85967b7… | stephan | 3 | |
| 85967b7… | stephan | 4 | # Directory Listing |
| 85967b7… | stephan | 5 | |
| 85967b7… | stephan | 6 | **Status:** implemented 20120316 |
| 85967b7… | stephan | 7 | |
| 85967b7… | stephan | 8 | **Required privileges:** "o". Was "h" prior to 20120720, but the HTML |
| 85967b7… | stephan | 9 | version of /dir changed permissions and this API was modified to match |
| 85967b7… | stephan | 10 | it. |
| 85967b7… | stephan | 11 | |
| 85967b7… | stephan | 12 | **Request:** `/json/dir` |
| 85967b7… | stephan | 13 | |
| 85967b7… | stephan | 14 | Options: |
| 85967b7… | stephan | 15 | |
| 85967b7… | stephan | 16 | - `checkin=commit` (use "tip" for the latest). If checkin is not set |
| 85967b7… | stephan | 17 | then all files from all versions of the tree are returned (but only |
| 85967b7… | stephan | 18 | once per file - not with complete version info for each file in all |
| 85967b7… | stephan | 19 | branches).\ |
| 85967b7… | stephan | 20 | CLI: `--checkin|-ci CHECKIN` |
| 85967b7… | stephan | 21 | - `name=subdirectory` name. To fetch the root directory, don't pass this |
| 85967b7… | stephan | 22 | option, or use an empty value or "/".\ |
| 85967b7… | stephan | 23 | CLI: use `--name|-n NAME` or pass it as the first argument after |
| 85967b7… | stephan | 24 | the `dir` subcommand. |
| 85967b7… | stephan | 25 | |
| 85967b7… | stephan | 26 | **Response payload example:** |
| 85967b7… | stephan | 27 | |
| 85967b7… | stephan | 28 | ```json |
| 85967b7… | stephan | 29 | { |
| 85967b7… | stephan | 30 | "name":"/", /* dir name */ |
| 85967b7… | stephan | 31 | "uuid":"ac6366218035ed62254c8d458f30801273e5d4fc", |
| 85967b7… | stephan | 32 | "checkin":"tip", |
| 85967b7… | stephan | 33 | "entries":[{ |
| 85967b7… | stephan | 34 | "name": "ajax", /* file name/dir name fragment */ |
| 85967b7… | stephan | 35 | "isDir": true, /* only set for directories */ |
| 85967b7… | stephan | 36 | /* The following properties are ONLY set if |
| 85967b7… | stephan | 37 | the 'checkin' parameter is provided. |
| 85967b7… | stephan | 38 | */ |
| 85967b7… | stephan | 39 | "uuid": "..." /*only for files, not dirs*/, |
| 85967b7… | stephan | 40 | "size": number, |
| 85967b7… | stephan | 41 | "timestamp": number |
| 85967b7… | stephan | 42 | },...] |
| 85967b7… | stephan | 43 | } |
| 85967b7… | stephan | 44 | ``` |
| 85967b7… | stephan | 45 | |
| 85967b7… | stephan | 46 | The checkin property is only set if the request includes it. The |
| 85967b7… | stephan | 47 | entry-specific uuid and size properties (e.g. `entries[0].uuid`) are |
| 85967b7… | stephan | 48 | only set if the checkin request property is set and they refer to the |
| 85967b7… | stephan | 49 | latest version of that file for the given checkin. The `isDir` property is |
| 85967b7… | stephan | 50 | only set on directory entries. |
| 85967b7… | stephan | 51 | |
| 85967b7… | stephan | 52 | This command does not recurse into subdirectories, though it "should be" |
| 85967b7… | stephan | 53 | simple enough to add the option to do so. |