-
微盘开发者协议
-
API接口文档
-
授权机制说明
-
权限与规则说明
-
API接口说明
-
错误代码说明
- SDK与演示
-
接口迁移指南
|
API接口说明
目录
-
用户相关:
文件、目录相关:
操作相关
分享相关
- /oauth2/authorize
- 功能:OAuth2的authorize接口
- 请求方法
- POST | GET https://auth.sina.com.cn/oauth2/authorize
- 参数说明:
-
参数 | 必选 | 类型 | 说明 |
client_id | Yes | string | 申请应用时分配的AppKey。 |
redirect_uri | Yes | string | 需要做urlencode。授权回调地址,站外应用需与设置的回调地址一致,站内应用需填写canvas page的地址。 |
response_type | No | string | 返回类型,支持code、token,默认值为code。 |
state | No | string | 需要做urlencode。用于保持请求和回调的状态,在回调时,会在Query Parameter中回传该参数。 |
display | No | string | 授权页面的终端类型,取值见下面的说明。 |
- Display说明:
-
参数取值 | 类型说明 |
default | 默认的授权页面,适用于web浏览器。 |
mobile | 移动终端的授权页面,适用于支持html5的手机。 |
popup | 弹窗类型的授权页,适用于web浏览器小窗口。 |
- response_type为code时的返回值:
-
返回值字段 | 字段类型 | 字段说明 |
code | string | 用于调用access_token,接口获取授权后的access token。 |
state | string | 如果传递参数,会回传该参数。 |
- response_type为token时的返回值:
-
返回值字段 | 字段类型 | 字段说明 |
access_token | string | 用来调用其它接口的授权过的accesstoken。 |
expires_in | string | accesstoken的过期时间点,unix的timestamp格式。 |
state | string | 如果传递参数,会回传该参数。 |
- 范例
-
response_type为token
//请求
https://auth.sina.com.cn/oauth2/authorize?client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=token
//同意授权后会重定向
http://www.example.com/response#access_token=ACCESS_TOKEN&expires_in=250327040&time_left=86400&uid=UID
其中 expires_in 是过期时间的时间点,时间戳格式;time_left是access_token剩余的时间,时间戳格式;uid是用户的唯一号。
response_type为code
//请求
https://auth.sina.com.cn/oauth2/authorize?client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=code
//同意授权后会重定向
http://www.example.com/response&code=CODE&state=STATE
- /oauth2/access_token
- 功能:OAuth2的access_token接口
- 请求方法
- POST https://auth.sina.com.cn/oauth2/access_token
- 参数说明:
-
参数 | 必选 | 类型 | 说明 |
client_id | Yes | string | 申请应用时分配的AppKey。 |
client_secret | Yes | string | 申请应用时分配的AppSecret。 |
grant_type | Yes | string | 请求的类型,可以为authorization_code、refresh_token。 |
- grant_type为authorization_code时:
-
参数 | 必选 | 类型 | 说明 |
code | Yes | string | 调用authorize获得的code值。 |
redirect_uri | Yes | string | 需要做urlencode。回调地址,需与注册应用里的回调地址一致。 |
- grant_type为refresh_token时:
-
参数 | 必选 | 类型 | 说明 |
refresh_token | Yes | string | 获取到的刷新token。 |
- 返回结果:
- 失败:
{
"code": "1090",
"msg": "error message"
}
- 成功:
- grant_type为authorization_code 或 refresh_token
{
"access_token": "ACCESS_TOKEN",
"expires_in": 1234,
"refresh_token": "REFRESH_TOKEN",
"time_left": 1234,
"uid": "UID"
}
- grant_type 为refresh_token的情况也会返回一个新的refresh token。
- /account/info
- 功能:获取用户信息
- 请求方法
- POST | GET https://api.weipan.cn/2/account/info
- 参数说明:
-
无参数
- 返回结果:(JSON实例)
{
uid: "17944188",
sina_uid: "1401648620",
quota_info: {
quota: "15091891264",
consumed: "5480876037"
},
verified: false,
screen_name: "communet",
user_name: "communet",
location: "北京 海淀区",
profile_image_url: "http://tp1.sinaimg.cn/1401648620/50/5652854136/1",
avatar_large: "http://tp1.sinaimg.cn/1401648620/180/5652854136/1",
gender: "m"
}
- 返回字段说明:
-
返回值字段 | 字段类型 | 字段说明 |
uid | string | 微盘用户ID |
sina_uid | string | 微博用户ID |
quota | string | 可用空间 |
consumed | string | 已用空间 |
verified | boolean | 是否是微博认证用户,即加V用户,true:是,false:否 |
screen_name | string | 用户昵称 |
user_name | string | 友好显示名称 |
location | string | 用户所在地区 |
profile_image_url | string | 用户头像地址,50×50像素 |
avatar_large | string | 用户大头像地址 |
gender | string | 性别,m:男、f:女、n:未知 |
- /delta
- 获取用户文件和目录操作变化记录。列表每页固定为 2000 条。
- 请求方法
- GET,POST https://api.weipan.cn/2/delta/<root>
root - 固定值:basic / sandbox (默认)
- 参数说明:
-
参数 | 必选 | 类型 | 说明 |
cursor |
No |
整数 | 仅取列表的起始位置。传递此参数时,接口返回的列表是此位置之后的操作变化记录。 |
- 返回结果:(JSON实例)
{
"reset": true,
"cursor": "217918400",
"has_more": false,
"entries": [
[
"/a.doc",
{
"revision": "296472955",
"rev": "72335092",
"thumb_exists": false,
"bytes": "7511040",
"modified": "Sat, 10 Nov 2012 03:20:34 +0000",
"path": "/a.doc",
"is_dir": false,
"icon": "page_white_word",
"root": "basic",
"size": "7.16 MB",
"md5": "36e2a82e2bac8cdf555ef9e8f77abb14",
"sha1": "6fe7801b7f7a25de482c0e9d81911e00d4b5d665"
}
],
[
"/Digital Radio System Design.pdf",
{
"revision": "306199874",
"rev": "77688539",
"thumb_exists": false,
"bytes": "3222914",
"modified": "Sat, 17 Nov 2012 12:54:27 +0000",
"path": "/Digital Radio System Design.pdf",
"is_dir": false,
"icon": "page_white_acrobat",
"root": "basic",
"size": "3.07 MB",
"md5": "b88c4061a80bb814d28c090a8b8de359",
"sha1": "53a669bc79b5fb1335345505132a054b926cf5c5"
}
]
]
}
- reset 不带 cursor 参数调用此接口时,此字段值为 true。或者在服务器端有维护需要强制通知客户端重新同步时为 true,其余为 false。
- cursor 一个字符串,表示已返回的列表在操作记录中的位置。下次调用此接口时把此值传递上来,以获取此后的列表。
- has_more 如果是 true ,表示还有更多记录可以返回,可继续调用此接口获取。如果是 false,表示没有更多记录了,建议至少 5 分钟后再调用。
- entries 操作记录详情列表。
- /files (GET)
- 功能:下载文件
- 请求方法
- GET https://api.weipan.cn/2/files/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 | 必选 | 类型 | 说明 |
rev |
No |
string | 目录的摘要,最长32位,版本号,默认为最新版本。 |
- /files_put
- PUT方式上传文件
- 当同时传递了 sha1 和 size 参数时,将会尝试秒传。如果云端存在可秒传的文件信息,将直接返回文件上传成功的信息,并且没有 100 Continue 响应头。
- 请求方法
- PUT http://upload-vdisk.sina.com.cn/2/files_put/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
overwrite |
No |
string |
true(默认) / false, 重名是否覆盖,选择false则重命名,如 test.txt 可能自动重命名成 test (1).txt。 |
parent_rev |
No |
string |
若使用此参数,则 overwrite 只按默认值 true 处理。若参数值不是此文件的有效版本号,返回错误消息 40404 Revision does not exist.;
参数值不是此文件的当前版本号,返回错误消息 40616 The revision is outdated.。 |
HTTP BODY |
Yes |
|
文件内容 |
sha1 |
No |
string |
文件sha1值 |
size |
No |
int |
文件体积 |
- 返回结果:(JSON实例)
{
"size": "27 bytes",
"rev": "112670777",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 07:41:49 +0000",
"path": "/1.txt",
"is_dir": false,
"root": "basic",
"icon": "page_white_text",
"mime_type": "text/plain",
"revision": "363112320",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61",
"is_deleted": false
}
- 错误码:
-
50701 User is over storage quota.
40306 Forbidden. The operation cannot be repeated.
41001 File is not uploaded successfully.
40404 Revision does not exist.
40403 No file or folder is found at the specified path.
40608 Maximum size of file allowed to be uploaded exceeded.
40302 There is already a file or folder at the given destination.
40601 Maximum number of folders within one folder exceeded. 一个目录下最多可以创建 1000 个目录,超出此限额时报错。
40607 The system cannot automatically add new files because maximum number of files within one folder exceeded.
40616 The revision is outdated. 版本已过时。
- /files(POST)
- POST方式上传文件
- 当同时传递了 sha1 和 size 参数时,将会尝试秒传。如果云端存在可秒传的文件信息,将直接返回文件上传成功的信息,并且没有 100 Continue 响应头。
- 请求方法
-
POST http://upload-vdisk.sina.com.cn/2/files/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
- file 参数请以 multipart/form-data 方式的表单 POST 提交, 其余参数请以 GET 参数传递
-
参数 |
必选 |
类型 |
说明 |
overwrite |
No |
string |
true(默认) / false, 重名是否覆盖,选择false则重命名,如 test.txt 可能自动重命名成 test (1).txt。 |
parent_rev |
No |
string |
若使用此参数,则 overwrite 只按默认值 true 处理。若参数值不是此文件的有效版本号,返回错误消息 40404 Revision does not exist.;
参数值不是此文件的当前版本号,返回错误消息 40616 The revision is outdated.。 |
file |
Yes |
|
文件内容 |
sha1 |
No |
string |
文件sha1值 |
size |
No |
int |
文件体积 |
- 返回结果:(JSON实例)
{
"size": "27 bytes",
"rev": "112831184",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 11:30:12 +0000",
"path": "/1.txt",
"is_dir": false,
"icon": "page_white_text",
"root": "basic",
"mime_type": "text/plain",
"revision": "363374209",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61"
}
- 错误码:
-
同files_put接口错误码
- /metadata
- 获取文件和目录信息
- 请求方法
- GET https://api.weipan.cn/2/metadata/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
hash |
No |
string |
最长32位,仅限数字和英文字母,目录的摘要,若果相同则返回304 (Not
Modified),否则返回目录信息. |
list |
No |
string |
true 或者 false, 默认为true. 如果是true, 返回的目录信息包含contents字段,contents的内容为当前目录的成员列表。 |
include_deleted |
No |
string |
true 或者 false,是否列出已删除的成员,默认为 false. |
- 返回结果:(JSON实例)
- 如果是文件:
{
"size": "27 bytes",
"rev": "112831184",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 11:30:12 +0000",
"path": "/1.txt",
"is_dir": false,
"icon": "page_white_text",
"root": "basic",
"mime_type": "text/plain",
"revision": "363374209",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61"
}
- 如果是目录:
{
"size": "0 bytes",
"hash": "eb78a93f30b7c902c20be2cadc1c5d11",
"rev": "ab595f5a",
"thumb_exists": false,
"bytes": "0",
"modified": "Wed, 26 Dec 2012 11:34:30 +0000",
"path": "/dd",
"is_dir": true,
"root": "basic",
"icon": "folder",
"revision": "115870075",
"is_deleted": false,
"contents": [
{
"size": "2.81 KB",
"rev": "112834369",
"thumb_exists": false,
"bytes": "2875",
"modified": "Wed, 26 Dec 2012 11:34:30 +0000",
"path": "/dd/t.txt",
"is_dir": false,
"root": "basic",
"icon": "page_white_text",
"mime_type": "text/plain",
"revision": "363379700",
"md5": "b0547b5af57d9f765e42f66a170b39e1",
"sha1": "7df3a1fd477def8a8c071d4a7adbe29d97b0416c",
"is_deleted": false
}
]
}
- 错误码:
-
40404 Revision does not exist.
40403 No file or folder is found at the specified path.
- /revisions
- 获得文件的历史版本
- 请求方法
- GET https://api.weipan.cn/2/revisions/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
rev_limit |
No |
整数 |
默认为 10,最大为 1,000。读取版本的个数。 |
- 返回结果:(JSON实例)
[
{
"size": "8.49 MB",
"rev": "89379872",
"thumb_exists": false,
"bytes": "8903548",
"modified": "Fri, 30 Nov 2012 16:21:01 +0000",
"path": "/PHP.Objects.Patterns.and.Practice.3rd.Edition.pdf",
"is_dir": false,
"icon": "page_white_acrobat",
"root": "basic",
"mime_type": "application/pdf",
"revision": "325785255",
"md5": "d5cbf772a2e745db6b952c7ed1eb54c5",
"sha1": "dcd254098afc80b110b15fba959b9825364d041b",
"is_deleted": false
}
]
- 错误码:
-
40402 Parent path does not exist.
40403 No file or folder is found at the specified path.
40604 Only a file is supported on this operation.
- /restore
- /restore 还原文件到某个版本
- 请求方法
- POST https://api.weipan.cn/2/restore/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
rev |
Yes |
整数 |
最长32位,要还原的版本号。 |
- 返回结果:(JSON实例)
[
{
"size": "8.49 MB",
"rev": "89379872",
"thumb_exists": false,
"bytes": "8903548",
"modified": "Fri, 30 Nov 2012 16:21:01 +0000",
"path": "/PHP.Objects.Patterns.and.Practice.3rd.Edition.pdf",
"is_dir": false,
"icon": "page_white_acrobat",
"root": "basic",
"mime_type": "application/pdf",
"revision": "325785255",
"md5": "d5cbf772a2e745db6b952c7ed1eb54c5",
"sha1": "dcd254098afc80b110b15fba959b9825364d041b"
}
]
- 错误码:
-
40402 Parent path does not exist.
40403 No file or folder is found at the specified path.
40404 Revision does not exist.
40614 No record of actionable.
50701 User is over storage quota.
- /search
- /search 返回符合搜索的所有文件和目录信息。搜索权限于指定的目录路径及其下级目录。
- 请求方法
- GET,POST https://api.weipan.cn/2/search/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
query |
Yes |
字符串 |
查询字符串,至少 3 个字符,至多 200 个字符。 |
file_limit |
No |
正整数 |
返回列表的条目数,默认值和最大值都是1000。 |
include_deleted |
No |
字符串 |
true / false, 是否包含已删除成员,默认false。 |
- 返回结果:(JSON实例),搜索到的结果列表。返回的结果按目录或文件的更新时间倒序排列。先返回目录,后返回文件,如果返回结果中记录条数已达到需要的条目总数,则不再返回剩余更多结果。
[
{
"size": "8.49 MB",
"rev": "89379872",
"thumb_exists": false,
"bytes": "8903548",
"modified": "Fri, 30 Nov 2012 16:21:01 +0000",
"path": "/PHP.Objects.Patterns.and.Practice.3rd.Edition.pdf",
"is_dir": false,
"icon": "page_white_acrobat",
"root": "basic",
"mime_type": "application/pdf",
"revision": "325785255",
"md5": "d5cbf772a2e745db6b952c7ed1eb54c5",
"sha1": "dcd254098afc80b110b15fba959b9825364d041b"
},
{
"size": "9.39 MB",
"rev": "83552047",
"thumb_exists": false,
"bytes": "9850805",
"modified": "Sat, 24 Nov 2012 16:12:12 +0000",
"path": "/PHP5 Power Programming.pdf",
"is_dir": false,
"icon": "page_white_acrobat",
"root": "basic",
"mime_type": "application/pdf",
"revision": "316403869",
"md5": "c6d777c0a2408c10265ab433b27284ed",
"sha1": "85988eec8cfb0d80702cbe4772fcdacb313d32de"
}
]
- 错误码:
-
40403 No file or folder is found at the specified path.
40605 Only a folder is supported on this operation.
- /shares
- /shares 描述创建并返回一个此分享文件的链接。
- 请求方法
- POST https://api.weipan.cn/2/shares/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
cancel |
No |
字符串 |
true / false, 取消分享链接 ,默认为false。 |
- 返回结果:(JSON实例)
- 成功新建分享文件时返回
{
"url": "http://vdisk.weibo.com/s/3oKv"
}
- 成功取消分享文件时返回
{
"share": false,
"size": "27 bytes",
"rev": "112831184",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 11:30:12 +0000",
"path": "/1.txt",
"is_dir": false,
"icon": "page_white_text",
"root": "basic",
"mime_type": "text/plain",
"revision": "363374209",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61"
}
- 错误码:
-
40002 Bad input parameter. Please use valid value for path.
40403 No file or folder is found at the specified path.
40604 Only a file is supported on this operation.
40304 Ths file is not allowed to share due to restriction policies.
40312 Share folder not allowed.
- /copy_ref
- /copy_ref 创建一个可以转存此分享文件的标识字符串。
- 请求方法
- POST https://api.weipan.cn/2/copy_ref/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 返回结果:(JSON实例)
{
"copy_ref": "3oKv"
}
- 错误码:
-
40403 No file or folder is found at the specified path.
40604 Only a file is supported on this operation.
40304 Ths file is not allowed to share due to restriction policies.
- /media
- /media 获取文件下载和播放的链接
- 请求方法
- GET https://api.weipan.cn/2/media/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 返回结果:(JSON实例)
{
"url": "http://data.vdisk.me/41598326/...",
"expires": "Wed, 26 Dec 2012 12:11:49 +0000"
}
- 错误码:
-
40604 Only a file is supported on this operation.
40404 Revision does not exist.
40402 Parent path does not exist.
40403 No file or folder is found at the specified path.
- /thumbnails
- /thumbnails 获取图片文件的缩略图
- 请求方法
- GET https://api.weipan.cn/2/thumbnails/<root>/<path>
root - 固定值:basic / sandbox (默认)
path - 文件路径.
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
size |
Yes |
字符串(s,m,l,xl) |
s:60x60,m:100x100,l:640x480,xl:1027x768 |
- 返回结果:
header location : 缩略图地址
- 错误码:
-
40402 Parent path does not exist.
40403 No file or folder is found at the specified path. 文件不存在。
40615 The input format is not supported for this operation. 指定的文件不能提供缩略图。支持缩略图的图片格式是 "bmp","gif","jpg","jpeg","pjpeg","png"。
41501 Maximum size of file allowed to be thumbnail exceeded. 最大支持 20MB 的图片。
- /fileops/copy
- /fileops/copy 复制一个对象。当前目录下的目录和文件总数不超过 10000 个时,可以执行此操作。超过此限额时,请进入更深层的目录分批操作。
- 请求方法
- POST https://api.weipan.cn/2/fileops/copy
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
root |
Yes |
字符串 |
固定值:basic / sandbox (默认) |
from_path |
No |
字符串 |
最长 200 |
to_path |
Yes |
字符串 |
最长 200 |
from_copy_ref |
No |
字符串 |
/copy_ref接口生成的copy_ref。from_path 和 from_copy_ref 选其一 |
-
- 返回结果:(JSON实例)
- 如果是文件:
{
"size": "27 bytes",
"rev": "112831184",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 11:30:12 +0000",
"path": "/1.txt",
"is_dir": false,
"icon": "page_white_text",
"root": "basic",
"mime_type": "text/plain",
"revision": "363374209",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61"
}
- 如果是目录:
{
"size": "0 bytes",
"hash": "eb78a93f30b7c902c20be2cadc1c5d11",
"rev": "ab595f5a",
"thumb_exists": false,
"bytes": "0",
"modified": "Wed, 26 Dec 2012 11:34:30 +0000",
"path": "/dd",
"is_dir": true,
"root": "basic",
"icon": "folder",
"revision": "115870075",
"is_deleted": false
}
- 错误码:
-
40002 Bad input parameter. Please use valid value for path.
40302 There is already a file or folder at the given destination.
40303 An invalid operation was attempted (e.g. copying or moving a folder to its own subfolder). 无效的操作,如把目录移动或复制到自己的子目录里。
40403 No file or folder is found at the specified path.
40601 Maximum number of folders within one folder exceeded. 一个目录下最多可以s创建 1000 个目录,超出此限额时报错。
40603 Too many files or folders would be involved in the operation for it to complete successfully.
50701 User is over storage quota.
40602 Maximum number of files within one folder exceeded.
40406 Reference file not found.
50003 File not stored.
- /fileops/create_folder
- /fileops/create_folder 创建目录. 一个目录下最多允许创建 1000 个子目录。
- 请求方法
- POST https://api.weipan.cn/2/fileops/create_folder
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
root |
Yes |
字符串 |
固定值:basic / sandbox (默认) |
path |
Yes |
字符串 |
最长 200 |
- 返回结果:(JSON实例)
{
"size": "0 bytes",
"hash": "eb78a93f30b7c902c20be2cadc1c5d11",
"rev": "8d4f9d0d",
"thumb_exists": false,
"bytes": "0",
"modified": "Wed, 26 Dec 2012 11:49:39 +0000",
"path": "/test",
"is_dir": true,
"root": "basic",
"icon": "folder",
"revision": "115626001",
"is_deleted": false
}
- 错误码:
-
40002 Bad input parameter. Please use valid value for path.
40402 Parent path does not exist.
40601 Maximum number of folders within one folder exceeded. 一个目录下最多可以创建 1000 个目录,超出此限额时报错。
40302 There is already a file or folder at the given destination.
- /fileops/delete
- /fileops/delete 删除一个对象。当前目录下的目录和文件总数不超过 10000 个时,可以执行此操作。超过此限额时,请进入更深层的目录分批操作。
- 请求方法
- POST https://api.weipan.cn/2/fileops/delete
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
root |
Yes |
字符串 |
固定值:basic / sandbox (默认) |
path |
No |
字符串 |
最长 200 |
- 返回结果:(JSON实例)
- 如果是文件:
{
"size": "27 bytes",
"rev": "112831184",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 11:30:12 +0000",
"path": "/1.txt",
"is_dir": false,
"icon": "page_white_text",
"root": "basic",
"mime_type": "text/plain",
"revision": "363374209",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61"
}
- 如果是目录:
{
"size": "0 bytes",
"hash": "eb78a93f30b7c902c20be2cadc1c5d11",
"rev": "ab595f5a",
"thumb_exists": false,
"bytes": "0",
"modified": "Wed, 26 Dec 2012 11:34:30 +0000",
"path": "/dd",
"is_dir": true,
"root": "basic",
"icon": "folder",
"revision": "115870075",
"is_deleted": false
}
- 错误码:
-
40002 Bad input parameter. Please use valid value for path.
40403 No file or folder is found at the specified path.
40603 Too many files or folders would be involved in the operation for it to complete successfully.
- /fileops/move
- /fileops/move 移动一个对象,当前目录下的目录和文件总数不超过 5000 个时,可以执行此操作。超过此限额时,请进入更深层的目录分批操作。
- 请求方法
- POST https://api.weipan.cn/2/fileops/move
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
root |
Yes |
字符串 |
固定值:basic / sandbox (默认) |
from_path |
No |
字符串 |
最长 200 |
to_path |
Yes |
字符串 |
最长 200 |
- 返回结果:(JSON实例)
- 如果是文件:
{
"size": "27 bytes",
"rev": "112831184",
"thumb_exists": false,
"bytes": "27",
"modified": "Wed, 26 Dec 2012 11:30:12 +0000",
"path": "/1.txt",
"is_dir": false,
"icon": "page_white_text",
"root": "basic",
"mime_type": "text/plain",
"revision": "363374209",
"md5": "9b1040870e8fd76d6d097d65444cf6bf",
"sha1": "1eb9beabcf43384ba27751239364a821fd8c9f61"
}
- 如果是目录:
{
"size": "0 bytes",
"hash": "eb78a93f30b7c902c20be2cadc1c5d11",
"rev": "ab595f5a",
"thumb_exists": false,
"bytes": "0",
"modified": "Wed, 26 Dec 2012 11:34:30 +0000",
"path": "/dd",
"is_dir": true,
"root": "basic",
"icon": "folder",
"revision": "115870075",
"is_deleted": false
}
- 错误码:
-
40002 Bad input parameter. Please use valid value for path.
40302 There is already a file or folder at the given destination.
40303 An invalid operation was attempted (e.g. copying or moving a folder to its own subfolder). 无效的操作,如把目录移动或复制到自己的子目录里。
40403 No file or folder is found at the specified path.
40601 Maximum number of folders within one folder exceeded. 一个目录下最多可以创建 1000 个目录,超出此限额时报错。
40603 Too many files or folders would be involved in the operation for it to complete successfully.
40602 Maximum number of files within one folder exceeded.
- /shareops/media
- /shareops/media 获取分享文件下载和播放的链接
- 请求方法
- GET https://api.weipan.cn/2/shareops/media
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
from_copy_ref |
Yes |
字符串 |
拷贝引用 |
-
- 返回结果:(JSON实例)
{
"url": "http://data.vdisk.me/...",
"expires": "Wed, 26 Dec 2012 11:59:34 +0000"
}
- 错误码:
-
40406 Reference file not found.
- /share/search
- /share/search 搜索分享的文件
- 请求方法
- GET https://api.weipan.cn/2/share/search
- 参数说明:
-
参数 |
必选 |
类型 |
说明 |
query |
Yes |
字符串 |
搜索关键词,可以传多个值,以|分隔。如query= txt|pdf|rar;按组查询时,可选doc,img,video,audio,else中一种 |
type |
No |
整型 |
搜索类型,1:全文件检索,2:按名称3:按标题,4:按描述5:按文件(夹)类型,6:按后缀,7:按组查询。
可以传多个type,如2:5:6,此时query值也以:分隔,表示各个type对应的query值,例如:query=web:doc并且type=3:7就表示查询分组是文档的并且标题中有关键字web的文件。
|
sort_order |
No |
字符串 |
排序字段,可以传多个,可用的值为:sharetime(分享时间),price(价格),degree(星级),count_download(下载量),bytes(大小),可以传多个,以:分隔 |
page |
No |
整型 |
当前页数(取值范围1-40),默认1 |
page_size |
No |
整型 |
每页大小(取值范围1-9999),默认20 |
-
- 返回结果:(JSON实例)
[
{
content_id: "12139472",
share_id: "55756656",
obj_id: "601801171",
obj_type: "0",
md5: "f7058b2e17bf87cafa0b2dffc46373c9",
sha1: "35492294f5ae88386b37742ddde7181f06b1e4a3",
uid: "748363",
share_status: "0",
count_browse: "1494",
count_download: "770",
count_copy: "27",
count_like: "0",
web_hot: false,
ios_hot: false,
android_hot: false,
price: 0,
degree: 0,
bytes: "3212",
rev: null,
name: "xxxxxxxxx",
revision: "601801171",
size: "3.14 KB",
is_dir: false,
icon: "page_white_compressed",
is_preview: false,
is_stream: false,
url: "http://data.vdisk.me.sinastorage.com/xxx/xxxxx",
copy_ref: "E6M0-dJCWub",
long_share_id: "2866784628577022841747",
long_content_id: "46238461718263736203",
mime_type: "application/x-rar-compressed",
thumb_exists: false,
link: "http://vdisk.weibo.com/s/xxxxx",
source_id: null,
category_id: "0",
root: "basic",
ip: "36.49.61.212",
share_type: "0",
share_auth: "1",
title: "the.great.gatsby.soxxxxx",
description: "the.great.xxxxxxxxx",
share_time: "Fri, 03 May 2013 00:14:51 +0000",
nick: "",
category_name: "",
app_key: "123456",
sina_uid: "1407722902",
path: null,
modified: "Fri, 03 May 2013 00:14:51 +0000",
thumbnail: ""
}
]
- 错误码:
-
40001 BAD_INPUT.
|