列出文件夹(目录)
- 请求地址 /v1/files/page
POST - 请求方式 JSON/Http POST
- 请求参数
| Properties | Type | Description |
|---|---|---|
| * parent | string | 该文件夹的ID(可选) |
| * path | string | 路径(可选) |
| * page | int | 第几页 |
| * pageSize | int | 列表大小 |
| * orderBy | int | 排序 0按 文件名 1 按时间 |
| * type | int | 文件类型 0 显示文件 1 显示文件夹 -1 显示文件和文件夹(默认) |
1.请求的时候,如果 name 和 path均为空,则会返回根目录 2.pageSize最大值为999,大于999将只返回999条记录
- 排序
- 0 文件夹排在前面, 创建时间倒序, 文件名正序 (典型:按创建时间倒序、按文件夹正序)
- 1 文件夹排在前面, 文件名正序,创建时间正序
- 2 文件夹排在前面, 文件名倒序,创建时间正序
- 3 文件夹排在前面, 文件名倒序,创建时间倒序 (典型:按文件名倒序)
- 4 文件夹排在前面, 文件名正序,创建时间正序 (典型:按文件名正序)
- 8 文件夹排在前面, 创建时间正序,文件名正序 (典型:按创建时间正序)
- 9 文件夹排在前面, 创建时间正序,文件名倒序
- 10 文件夹排在前面, 创建时间倒序,文件名倒序
- 11 文件夹排在前面, 创建时间正序,文件名正序
- 14 文件排在前面,创建时间倒序,文件名正序 (典型:文件名正序)
文件Metadata
文件夹 Meta信息如下:
| Properties | Type | Description |
|---|---|---|
| uuid | string | 该文件/文件夹的唯一ID |
| name | string | 文件名 |
| mime | string | 文件mime,即文件的类型 |
| type | int | 0:为文件,1:目录 |
| parent | string | 父目录id |
| ctime | long | 文件创建时间 |
| mtime | string | 文件修改时间 |
| atime | string | 文件访问时间 |
| userId | long | 用户id |
| path | string | 该文件或文件夹的访问路径 |
| ext | string | 后缀 |
| size | long | 文件大小(字节) |
| flag | int | 总是 0 |
| preview | int | 预览状态 |
| recycle | int | 0:正常文件,1:回收站 |
示例
- 列出根目录
发送 /v1/files/page :
{}
收到:
{"status": 200,"result": {"page": 1,"pageSize": 20,"totalCount": 5,"totalPage": 1,"list": [{"uuid": "4a394153a3284b57ab32dd19057bf4c8","storeId": "","userId": 5,"path": "/123","name": "123","ext": "","size": 0,"parent": "e724aaabf0c544bba3aef642455d104e","type": 1,"atime": 1532601197732,"ctime": 1532601197732,"mtime": 0,"version": 0,"locking": false,"mime": "application/x-directory","preview": -1,"flag": 0},{"uuid": "9ad4d23682714ad2a5168ad91a6e93b5","storeId": "","userId": 5,"path": "/456","name": "456","ext": "","size": 0,"parent": "e724aaabf0c544bba3aef642455d104e","type": 1,"atime": 1532601218238,"ctime": 1532601218238,"mtime": 0,"version": 0,"locking": false,"mime": "application/x-directory","preview": -1,"flag": 0},{"uuid": "08b1fe17a2164f4a851f45c4cc984109","storeId": "","userId": 5,"path": "/11133","name": "11133","ext": "","size": 0,"parent": "e724aaabf0c544bba3aef642455d104e","type": 1,"atime": 1532603220059,"ctime": 1532603220059,"mtime": 0,"version": 0,"locking": false,"mime": "application/x-directory","preview": -1,"flag": 0},{"uuid": "65ae1e0df8ea45d6abafbeff21f504c4","storeId": "","userId": 5,"path": "/null","name": "null","ext": "","size": 0,"parent": "e724aaabf0c544bba3aef642455d104e","type": 1,"atime": 1532762745920,"ctime": 1532762745920,"mtime": 0,"version": 0,"locking": false,"mime": "application/x-directory","preview": -1,"flag": 0},{"uuid": "311951072e804c179c234a3e054de51b","storeId": "","userId": 5,"path": "/d","name": "d","ext": "","size": 0,"parent": "e724aaabf0c544bba3aef642455d104e","type": 1,"atime": 1532780479835,"ctime": 1532780479835,"mtime": 0,"version": 0,"locking": false,"mime": "application/x-directory","preview": -1,"flag": 0}],"info": {"uuid": "e724aaabf0c544bba3aef642455d104e","storeId": "","userId": 5,"path": "/","name": "","ext": "","size": 0,"parent": "","type": 1,"atime": 1532601155841,"ctime": 1532601155841,"mtime": 1532601155841,"version": 0,"locking": false}}"code": "OK","success": true,"token": "..."}
- 使用path列出文件夹(推荐)
发送 /v1/files/page :
{"path":"/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm"}
收到:
{"status": 200,"result": {"page": 1,"pageSize": 20,"totalCount": 3,"totalPage": 1,"path": [{"uuid": "528","storeId": "","userId": 11,"path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/jka","size": 0,"parent": "524","mime": "application/x-directory","type": 1,"atime": 1522074711237,"mtime": 1522074711237,"ctime": 1522074711237,"alias": "","from": 0,"name": "jka","ext": "","preview": 0,"flag": 0,"recycle": 0},{"uuid": "527","storeId": "","userId": 11,"pathId": "bda8a307284501d3b03458820b8631ec","path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/中文路径","size": 0,"parent": "524","mime": "application/x-directory","type": 1,"atime": 1522036499927,"mtime": 1522036499927,"ctime": 1522036499927,"alias": "","from": 0,"name": "中文路径","ext": "","preview": 0,"flag": 0,"recycle": 0},{"uuid": "526","storeId": "","userId": 11,"pathId": "5086788dcfe9a204c78608e11144c611","path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/papaya","size": 0,"parent": "524","mime": "application/x-directory","type": 1,"atime": 1522036319687,"mtime": 1522036319687,"ctime": 1522036319687,"alias": "","from": 0,"name": "papaya","ext": "","preview": 0,"flag": 0,"recycle": 0}],"info": {"uuid": "524","storeId": "","userId": 11,"pathId": "d284c0c2825d280545a9b29f5d8c84d2","path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm","size": 0,"parent": "523","mime": "application/x-directory","type": 1,"atime": 1522036319294,"mtime": 1522036319294,"ctime": 1521995361898,"alias": "","from": 0,"name": "rcm","ext": "","preview": 0,"flag": 0,"recycle": 0}},"code": "OK","success": true,"token": "..."}
