Resource
danger
ONES API 已废弃。请使用Open API。
- model
- 1. 上传资源
- 2. 上传文件
- 3. 获取附件资源
- 4. 获取项目相关附件资源列表
- 5. 获取任务相关附件资源列表
- 6. 获取里程碑附件资源列表
- 7. 批量删除资源
- 8. 修改资源名字和描述
- 9. 批量获取附件资源
通用说明
API 说明
model
resource
资源模型
参数名 | 参数类型 | 取值范围 | 说明 |
---|---|---|---|
type | string | type | 资源类型 |
source | string | "",edit,page | 图片来源, "edit": 编辑器, "page": 页面, 为了兼容之前版本, 默认值为 page |
name | string | 字符个数 [0,255) | 资源 name |
hash | string | len=28 | hash 值(可以留空或者省略) 计算方法可以参照七牛相关文档和各平台示例 |
ref_type | string | 当 type=attachment 时值 ref_type 之一 | |
ref_id | string | 对应 ref_type 的 uuid | |
ignore_notice | bool | 是否忽略通知 | |
description | string | 字符个数 [0,64) | 描述 |
type
资源类型
取值范围 | mime limit | 说明 |
---|---|---|
avatar | image/* | 用户头像,大小限制5MB |
team_logo | image/* | 团队 logo,大小限制5MB |
attachment | * | 任务/消息附件,能上传任意类型的文件,大小限制50MB |
jira_backup | application/zip | |
confluence_backup | application/zip | |
word | application/vnd.openxmlformats-officedocument.wordprocessingml.document | word 文件 |
word_zip | application/zip | word 压缩文件 |
reftype
当 type=attachment 时,ref_type
取值范围 | 说明 |
---|---|
project | 项目附件 |
milestone | 里程碑附件 |
task | 工作项附件 |
space | wiki 附件 |
user | 用户附件 |
jira | jira 附件 |
1. 上传资源
附件分为公开资源,和非公开资源。
公开资源指已上传到服务器上的公开资源文件。
非公开资源:需要调用资源上传接口上传文件。
URL
https://your-host-name/project/api/project/team/:teamUUID/res/attachments/upload
请求类型
POST
请求参数
返回参数列表
参数名 | 参数类型 | 说明 |
---|---|---|
need_upload | bool | 是否需要上传文件 |
base_url | string | |
upload_url | string | 上传地址 |
token | string | token |
resource_uuid | string | 资源 UUID |
size_limit | int | size |
file | file | 文件描述 |
file
参数名 | 参数类型 | 说明 |
---|---|---|
hash | string | 资源 hash |
url | string | 资源地址 |
name | string | name |
size | int | size |
mime | string | mime |
请求参数参考
{
"type": "avatar",
"name": "IMG_3422.jpg",
"hash": "FrZolWudsknm8xvTre8C58TXVGhw"
}
{
"type": "team_logo",
"name": "IMG_3422.jpg",
"hash": "re8C58TXVGhwFrZolWudsknm8xvT"
}
{
"type": "attachment",
"ref_type": "project",
"ref_id": "VcbR2ORJG1lPWlTq",
"name": "example.ppt",
"hash": "FhafioiyVcbR2ORJG1lPWlTqT8Tn"
}
{
"type": "jira_backup",
"ref_type": "jira",
"name": "jira_backup.zip"
}