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