简要描述:

  • 获取文件和文件夹列表。
    通过本接口可以获取以下特定的文件和文件夹列表,1. 指定文件夹列表。2. 数据排序。3. 文件类型。4. 关键字。

接口版本:

版本号 制定人 制定日期 修订日期
1.0 Joe 2020-05-20 2020-05-20

请求URL:

请求参数:

参数名 是否必须 类型 说明
folder_id string 当前目录文件夹ID,根目录为d0
start int 起始位置,默认每次获取50条数据
reload int 1 为获取0至start位置的所有数据,默认为0,从start获取50条数据
orderby string old,az,za,big,small,new。new,old新旧排序,az,za,A-Z/Z-A排序,big,small,从文件大到小,小到大排序, 共6个排序方式,客户端需要本地记录用户排序偏好,如果留空则默认为”new”从新到旧
filter string video,music,picture,document,app,zip,other。默认为空,即全部文件类型
keyword string 列举包含关键字的文件和文件夹

请求示例:

POST /v1/public/file/list HTTP/1.1
HOST: rest.ctfile.com
content-type: application/json
content-length: 134

{
  "filter": "null",
  "folder_id": "d0",
  "orderby": "old",
  "start": "0",
  "session": "41e20167a3b05a21c47265dd3c262c92"
}

返回示例:

正常返回:

{"code":200,"num":11,"folder_id":"d0","folder_path":"\/","results":[{"key":"d28113370","icon":"folder","name":"1111","date":1525002659,"status":1},{"key":"d31688185","icon":"folder","name":"\u683c\u5f0f","date":1545278903,"status":1},{"key":"d37913835","icon":"folder","name":"\u95ee\u9898\u53cd\u9988","date":1584351685,"status":1},{"key":"d39772209","icon":"folder","name":"2222","date":1593616656,"status":1},{"key":"f225245699","icon":"7z","name":"china - \u9171\u6cb9\u96c6\u5408\u66f2.7z","imgsrc":"","size":72787355,"date":1508579218,"status":1},{"key":"f225245783","icon":"rar","name":"china - \u9171\u6cb9\u96c6\u5408\u66f2.rar","imgsrc":"","size":73009652,"date":1508579278,"status":1},{"key":"f229307013","icon":"file","name":"win10-Gench.GHO","imgsrc":"","size":10288976891,"date":1511345163,"status":1},{"key":"f229307016","icon":"file","name":"DELL 3050 Win7 64 IE8.gho","imgsrc":"","size":12954629366,"date":1511345168,"status":1},{"key":"f291744784","icon":"mp4","name":"\u6ca1\u6709\u4f60\u966a\u4f34\u771f\u7684\u597d\u5b64\u5355 \u5192\u6d3e\u97f3\u4e50\u5f00\u4e1a\u76db\u5178 \u73b0\u573a\u7248 -- \u68a6\u7136.mp4","imgsrc":"https:\/\/dynamic-media-cdn.tripadvisor.com\/media\/photo-o\/14\/c1\/a5\/f9\/vidam-park.jpg?w=500&h=800","size":215076467,"date":1526880887,"status":1},{"key":"f373836005","icon":"rar","name":"china.rar","imgsrc":"","size":73009652,"date":1557552617,"status":1},{"key":"f414453614","icon":"file","name":"WINXPSP3 Mobile.gho","imgsrc":"","size":2688072655,"date":1576737847,"status":1},{"key":"f414453617","icon":"file","name":"WIN10 1709 X64 \u7eaf\u51c0\u7248.gho","imgsrc":"","size":4010569154,"date":1576737847,"status":1},{"key":"f436664744","icon":"txt","name":"\u4e0b\u8f7d1.txt","imgsrc":"","size":6216,"date":1586656128,"status":1},{"key":"f437688657","icon":"dmg","name":"ctfile.dmg","imgsrc":"","size":127246979,"date":1586921764,"status":1},{"key":"f453876514","icon":"rar","name":"\u8fc5\u96f7.rar","imgsrc":"","size":491380922,"date":1595142438,"status":1}]}

错误时返回:

{"code":403,"message":"错误描述"}

返回参数说明:

参数名 类型 说明
key string 文件ID
icon string 文件图标
imgsrc string 视频/图片的缩略图URL
weblink string 网页分享地址(不包含密码)
name string 文件名称
size long 文件大小(bytes)
date timestamp 文件上传时间
status int 1: complete, 2: incomplete。如果为2,属于incomplete的状态,那请添加个未完成的icon(未完成的文件不支持下载、打包、解压)

备注:

  • 更多返回错误代码请看首页的错误代码描述
文档更新时间: 2021-11-26 12:24   作者:admin