列出文件夹(目录)

  • 请求地址 /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 :

  1. {
  2. }

收到:

  1. {
  2. "status": 200,
  3. "result": [
  4. {
  5. "uuid": "525",
  6. "storeId": "",
  7. "userId": 11,
  8. "pathId": "d75ceeec1975f079b2f0800566b0212e",
  9. "path": "/papaya",
  10. "size": 0,
  11. "parent": "",
  12. "mime": "application/x-directory",
  13. "type": 1,
  14. "atime": 1522036255238,
  15. "mtime": 1522036255238,
  16. "ctime": 1522036255238,
  17. "alias": "",
  18. "from": 0,
  19. "name": "papaya",
  20. "ext": "",
  21. "preview": 0,
  22. "flag": 0,
  23. "recycle": 0
  24. },
  25. {
  26. "uuid": "510",
  27. "storeId": "",
  28. "userId": 11,
  29. "pathId": "93fc1381dcdc015dab308d7fd5fbb7c4",
  30. "path": "/f@ck",
  31. "size": 0,
  32. "parent": "",
  33. "mime": "application/x-directory",
  34. "type": 1,
  35. "atime": 1521995357796,
  36. "mtime": 1521995357796,
  37. "ctime": 1521995357796,
  38. "alias": "",
  39. "from": 0,
  40. "name": "f@ck",
  41. "ext": "",
  42. "preview": 0,
  43. "flag": 0,
  44. "recycle": 0
  45. }
  46. ],
  47. "code": "OK",
  48. "success": true,
  49. "token": "..."
  50. }
  • 使用path列出文件夹(推荐)

发送 /v1/files/page :

  1. {
  2. "path":"/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm"
  3. }

收到:

  1. {
  2. "status": 200,
  3. "result": [
  4. {
  5. "uuid": "528",
  6. "storeId": "",
  7. "userId": 11,
  8. "pathId": "dd2371b598af24db623c41283de54dd9",
  9. "path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/jka",
  10. "size": 0,
  11. "parent": "524",
  12. "mime": "application/x-directory",
  13. "type": 1,
  14. "atime": 1522074711237,
  15. "mtime": 1522074711237,
  16. "ctime": 1522074711237,
  17. "alias": "",
  18. "from": 0,
  19. "name": "jka",
  20. "ext": "",
  21. "preview": 0,
  22. "flag": 0,
  23. "recycle": 0
  24. },
  25. {
  26. "uuid": "527",
  27. "storeId": "",
  28. "userId": 11,
  29. "pathId": "bda8a307284501d3b03458820b8631ec",
  30. "path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/中文路径",
  31. "size": 0,
  32. "parent": "524",
  33. "mime": "application/x-directory",
  34. "type": 1,
  35. "atime": 1522036499927,
  36. "mtime": 1522036499927,
  37. "ctime": 1522036499927,
  38. "alias": "",
  39. "from": 0,
  40. "name": "中文路径",
  41. "ext": "",
  42. "preview": 0,
  43. "flag": 0,
  44. "recycle": 0
  45. },
  46. {
  47. "uuid": "526",
  48. "storeId": "",
  49. "userId": 11,
  50. "pathId": "5086788dcfe9a204c78608e11144c611",
  51. "path": "/f@ck/de/de/d/ede/d/xe/de/w/x/e/r/fr/f/rcm/papaya",
  52. "size": 0,
  53. "parent": "524",
  54. "mime": "application/x-directory",
  55. "type": 1,
  56. "atime": 1522036319687,
  57. "mtime": 1522036319687,
  58. "ctime": 1522036319687,
  59. "alias": "",
  60. "from": 0,
  61. "name": "papaya",
  62. "ext": "",
  63. "preview": 0,
  64. "flag": 0,
  65. "recycle": 0
  66. }
  67. ],
  68. "code": "OK",
  69. "success": true,
  70. "token": "..."
  71. }