列出文件夹(目录)
- 请求地址 /v1/files/list
POST - 请求方式 JSON/Http POST
- 请求参数
| Properties | Type | Description |
|---|---|---|
| * parent | string | 该文件夹的id(可选) |
| * path | string | 路径(可选) |
| * start | int | 从第几条开始 |
| * size | int | 列表大小 |
| * recycle | int | 默认不显示已经回收的文件。使用-1 显示所有文件,使用1只显示回收站 |
| * mime | string | 列出文件夹下面某一类型的文件,支持通配符,比如image/* |
| * orderBy | int | 排序 0按 文件名 1 按时间 |
| * type | int | 文件类型 0 显示文件 1 显示文件夹 -1 显示文件和文件夹 |
1.请求的时候,如果 name 和 path均为空,则会返回根目录 2.pageSize最大值为999,大于999将只返回999条记录
文件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 | 该文件或文件夹的访问路径 |
| size | long | 文件大小(字节) |
| alias | string | 文件别名 |
| flag | int | 总是 0 |
| preview | int | 预览状态 |
| recycle | int | 0:正常文件,1:回收站 |
示例
- 列出根目录
发送 /v1/files/list :
{}
收到:
{"status": 200,"result": [{"uuid": "525","storeId": "","userId": 11,"pathId": "d75ceeec1975f079b2f0800566b0212e","path": "/papaya","size": 0,"parent": "","mime": "application/x-directory","type": 1,"atime": 1522036255238,"mtime": 1522036255238,"ctime": 1522036255238,"alias": "","from": 0,"name": "papaya","ext": "","preview": 0,"flag": 0,"recycle": 0},{"uuid": "510","storeId": "","userId": 11,"pathId": "93fc1381dcdc015dab308d7fd5fbb7c4","path": "/f@ck","size": 0,"parent": "","mime": "application/x-directory","type": 1,"atime": 1521995357796,"mtime": 1521995357796,"ctime": 1521995357796,"alias": "","from": 0,"name": "f@ck","ext": "","preview": 0,"flag": 0,"recycle": 0}],"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": [{"uuid": "528","storeId": "","userId": 11,"pathId": "dd2371b598af24db623c41283de54dd9","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}],"code": "OK","success": true,"token": "..."}
