# 说明
关联工作项和Git分支
# url
https://apiv2.tapd.tencent.com/branch_object
# 支持格式
JSON/XML(默认JSON格式)
# HTTP请求方式
POST
# 请求数限制
通过参数object_info[],支持批量创建多个工作项关联同一个分支
# 请求参数
字段名 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
object_info[] | 是 | string | 1.工作项json,如{"workspace_id":69993260,"type":"mini_item","object_id":1069993260856110919},如果多个工作项关联同一个分支可以传多个 2.使用json格式传递时,参数格式参考下面实例 |
repo_id | 否 | integer | 代码仓库ID |
repo_name | 是 | string | 代码仓库名 |
repo_url | 是 | string | 代码仓库地址 |
branch | 是 | string | 分支名 |
operator | 是 | string | 操作人 |
create_from | 否 | string | 分支创建自(如master) |
# 调用示例及返回结果
# 关联工作项和Git分支
# json请求参数格式
{
"workspace_id":69993260,
"repo_name":"orangecyang/mini_project_git",
"repo_url":"https://git.woa.com/orangecyang/mini_project_git",
"branch":"test",
"operator":"orangecyang",
"object_info":["{\"workspace_id\":69993260,\"type\":\"mini_item\",\"object_id\":1069993260856110917}", "{\"workspace_id\":69993260,\"type\":\"mini_item\",\"object_id\":1069993260856113475}"]
}
2
3
4
5
6
7
8
# curl 使用 Basic Auth 鉴权调用示例
curl -u 'api_user:api_password' -d 'object_info[]={"workspace_id":69993260,"type":"mini_item","object_id":1069993260856110917}&object_info[]={"workspace_id":69993260,"type":"mini_item","object_id":1069993260856113475}&repo_id=11421734&repo_name=orangecyang/mini_project_git&repo_url=https://test.git.woa.com/orangecyang/mini_project_git' 'https://apiv2.tapd.tencent.com/branch_object'
# curl 使用 OAuth Access Token 鉴权调用示例
curl -H 'Authorization: Bearer ACCESS_TOKEN' -d 'object_info[]={"workspace_id":69993260,"type":"mini_item","object_id":1069993260856110917}&object_info[]={"workspace_id":69993260,"type":"mini_item","object_id":1069993260856113475}&repo_id=11421734&repo_name=orangecyang/mini_project_git&repo_url=https://test.git.woa.com/orangecyang/mini_project_git' 'https://apiv2.tapd.tencent.com/branch_object'
# 返回结果
{
"status": 1,
"data": [
{
"CodeBranchObjects": {
"id": "1069993260000032187",
"repo_id": "11421734",
"repo_name": "orangecyang/mini_project_git",
"repo_url": "https://test.git.woa.com/orangecyang/mini_project_git",
"branch": "refs/heads/test",
"branch_status": "0",
"create_from": "",
"type": "mini_item",
"object_id": "1069993260856110917",
"workitem_type_id": "0",
"workspace_id": "69993260",
"created": "2023-07-19 12:47:12",
"modified": "2023-07-19 12:47:12",
"is_deleted": "0",
"operator": "orangecyang",
"creator_from": "api",
"creator": "orangecyang"
}
},
{
"CodeBranchObjects": {
"id": "1069993260000032189",
"repo_id": "11421734",
"repo_name": "orangecyang/mini_project_git",
"repo_url": "https://test.git.woa.com/orangecyang/mini_project_git",
"branch": "refs/heads/test",
"branch_status": "0",
"create_from": "",
"type": "mini_item",
"object_id": "1069993260856113475",
"workitem_type_id": "0",
"workspace_id": "69993260",
"created": "2023-07-19 12:47:12",
"modified": "2023-07-19 12:47:12",
"is_deleted": "0",
"operator": "orangecyang",
"creator_from": "api",
"creator": "orangecyang"
}
}
],
"info": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
← 获取附件 保存Commit提交数据 →