新建文件夹(目录)
- 请求地址 /v1/files/createDirectory
POST - 请求方式 JSON/Http POST
- 请求参数
| Properties | Type | Description |
|---|---|---|
| name | string | 该文件夹的名字(可选) |
| path | string | 路径(可选) |
1.请求的时候,如果 name 和 path均为空,则会返回根目录 2.如果name为空,直接创建path 3.如果path为空,在根目录下创建名为name的文件夹 4.如果均不为空,则创建 ${path}/${name} 的目录
- 或者使用parent加name的方式创建
| Properties | Type | Description |
|---|---|---|
| name | string | 该文件夹的名字 |
| parent | string | 父路径uuid |
1.请求的时候,如果 name 和 parent 均为空,则会返回根目录 2.如果name为空,会创建以当前时间戳命名的文件夹 3.如果parent为空,在根目录下创建
文件Metadata
文件夹 Meta信息如下:
| Properties | Type | Description |
|---|---|---|
| uuid | string | 该文件/文件夹的唯一ID |
| storeId | string | 文件所属用户 |
| 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 | 文件大小(字节) |
| ext | string | 文件扩展名 |
| preview | int | 预览状态 |
| locking | bool | 文件是否锁定 |
示例
- 使用parent、name 获取文件夹(不推荐)
发送 /v1/files/createDirectory :
{"parent":"524","name":"papaya"}
收到:
{"status": 200,"result": {"uuid": "79e99862035241b3998c69daa4c559ef","storeId": "","userId": 5,"pathId": "37375a7a6d5e18f594d558f223dc63a9","lft": 4,"rgt": 5,"path": "/11133/i 好/i 好","name": "i 好","ext": "","size": 0,"parent": "58c38f8df01a421888c24e8a40bf7834","type": 1,"atime": 1532604193243,"ctime": 1532604193243,"mtime": 0,"version": 0,"locking": false},"code": "OK","success": true,"token": "..."}
- 使用path创建文件夹(推荐)
发送 /v1/files/get :
{"path":"/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/中文路径"}
收到:
{"status": 200,"result": {"uuid": "79e99862035241b3998c69daa4c559ef","storeId": "","userId": 5,"pathId": "37375a7a6d5e18f594d558f223dc63a9","lft": 4,"rgt": 5,"path": "/11133/i 好/i 好","name": "i 好","ext": "","size": 0,"parent": "58c38f8df01a421888c24e8a40bf7834","type": 1,"atime": 1532604193243,"ctime": 1532604193243,"mtime": 0,"version": 0,"locking": false},"code": "OK","success": true,"token": "..."}
发送 /v1/files/get :
{"path":"/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm","name":"中文路径2"}
收到:
{"status": 200,"result": {"uuid": "79e99862035241b3998c69daa4c559ef","storeId": "","userId": 5,"pathId": "37375a7a6d5e18f594d558f223dc63a9","lft": 4,"rgt": 5,"path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm","name": "i 好","ext": "","size": 0,"parent": "58c38f8df01a421888c24e8a40bf7834","type": 1,"atime": 1532604193243,"ctime": 1532604193243,"mtime": 0,"version": 0,"locking": false},"code": "OK","success": true,"token": "..."}
