议题 API
- Tier: 基础版,专业版,旗舰版
- Offering: JihuLab.com,私有化部署
使用议题 API 来以编程方式读取和管理极狐GitLab 议题。议题 API:
- 在项目和群组间创建、更新和删除议题。
- 管理议题的元数据,如受托人、标签、里程碑和时间跟踪。
- 支持议题和合并请求之间的交叉引用。
- 跟踪议题在项目和史诗之间的移动和提升。
- 通过授权检查控制访问和可见性。
如果用户不是私有项目的成员,对该项目的 GET 请求将导致 404 状态码。
议题分页
默认情况下,GET 请求一次返回 20 个结果,因为 API 结果是分页的。阅读更多关于分页的信息。
列出议题
获取经过身份验证的用户有权访问的所有议题。默认情况下,它只返回由当前用户创建的议题。要获取所有议题,请使用参数 scope=all。
plaintext1GET /issues 2GET /issues?assignee_id=5 3GET /issues?author_id=5 4GET /issues?confidential=true 5GET /issues?iids[]=42&iids[]=43 6GET /issues?labels=foo 7GET /issues?labels=foo,bar 8GET /issues?labels=foo,bar&state=opened 9GET /issues?milestone=1.0.0 10GET /issues?milestone=1.0.0&state=opened 11GET /issues?my_reaction_emoji=star 12GET /issues?search=foo&in=title 13GET /issues?state=closed 14GET /issues?state=opened
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| assignee_id | integer | No | 返回分配给指定用户 id 的议题。与 assignee_username 互斥。 None 返回未分配的议题。 Any 返回有受托人的议题。 |
| assignee_username | string array | No | 返回分配给指定 username 的议题。与 assignee_id 互斥。在极狐GitLab 基础版中,assignee_username 数组只能包含一个值,否则将返回无效参数错误。 |
| author_id | integer | No | 返回由指定用户 id 创建的议题。与 author_username 互斥。结合 scope=all 或 scope=assigned_to_me 使用。 |
| author_username | string | No | 返回由指定 username 创建的议题。与 author_id 类似并互斥。 |
| confidential | boolean | No | 过滤机密或公共议题。 |
| created_after | datetime | No | 返回在指定时间或之后创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| created_before | datetime | No | 返回在指定时间或之前创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| due_date | string | No | 返回没有到期日期、已过期或到期日期为本周、这个月或两周前至下个月之间的议题。接受:0(无到期日期),any,today,tomorrow,overdue,week,month,next_month_and_previous_two_weeks。 |
| epic_id | integer | No | 返回与给定史诗 ID 关联的议题。 None 返回未与史诗关联的议题。 Any 返回与史诗关联的议题。仅适用于专业版和旗舰版。 |
| health_status | string | No | 返回具有指定 health_status 的议题。在极狐GitLab 15.4 中引入。在极狐GitLab 15.5 及以后,None 返回没有健康状态分配的议题,Any 返回有健康状态分配的议题。仅限旗舰版。 |
| iids[] | integer array | No | 仅返回具有指定 iid 的议题。 |
| in | string | No | 修改 search 属性的范围。title、description 或用逗号连接的字符串。默认是 title,description。 |
| issue_type | string | No | 过滤到指定类型的议题。包括 issue,incident,test_case 或 task。 |
| iteration_id | integer | No | 返回分配给指定迭代 ID 的议题。 None 返回不属于迭代的议题。 Any 返回属于迭代的议题。与 iteration_title 互斥。仅适用于专业版和旗舰版。 |
| iteration_title | string | No | 返回分配给指定标题的迭代的议题。与 iteration_id 类似并互斥。仅适用于专业版和旗舰版。 |
| labels | string | No | 用逗号分隔的标签名称列表,议题必须具有所有标签才能返回。None 列出所有没有标签的议题。Any 列出至少有一个标签的所有议题。No+Label(已弃用)列出所有没有标签的议题。预定义的名称不区分大小写。 |
| milestone_id | string | No | 返回分配给具有给定时间框值(None,Any,Upcoming 和 Started)的里程碑的议题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。Upcoming 列出所有分配给未来里程碑的议题。Started 列出所有分配给打开的、已开始的里程碑的议题。milestone 和 milestone_id 是互斥的。 |
| milestone | string | No | 里程碑标题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。使用 None 或 Any 将在未来被弃。请改用 milestone_id 属性。milestone 和 milestone_id 是互斥的。 |
| my_reaction_emoji | string | No | 返回由经过身份验证的用户通过指定的 emoji 响应的议题。None 返回未给予反应的议题。Any 返回至少给予一个反应的议题。 |
| non_archived | boolean | No | 仅从非存档项目中返回议题。如果为 false,响应将返回存档和非存档项目中的议题。默认值为 true。 |
| not | Hash | No | 返回不符合所提供参数的议题。接受:assignee_id,assignee_username,author_id,author_username,iids,iteration_id,iteration_title,labels,milestone,milestone_id 和 weight。 |
| order_by | string | No | 返回按 created_at,due_date,label_priority,milestone_due,popularity,priority,relative_position,title,updated_at 或 weight 字段排序的议题。默认是 created_at。 |
| scope | string | No | 返回指定范围的议题:created_by_me,assigned_to_me 或 all。默认为 created_by_me。 |
| search | string | No | 根据议题的 title 和 description 搜索议题。 |
| sort | string | No | 返回按 asc 或 desc 顺序排序的议题。默认是 desc。 |
| state | string | No | 返回 all 议题或仅返回 opened 或 closed 的议题。 |
| updated_after | datetime | No | 返回在指定时间或之后更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| updated_before | datetime | No | 返回在指定时间或之前更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| weight | integer | No | 返回具有指定 weight 的议题。None 返回没有权重分配的议题。Any 返回有权重分配的议题。仅适用于专业版和旗舰版。 |
| with_labels_details | boolean | No | 如果为 true,响应将返回标签字段中每个标签的更多详细信息::name,:color,:description,:description_html,:text_color。默认是 false。 |
示例请求:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/issues"
示例响应:
json1[ 2 { 3 "state" : "opened", 4 "description" : "Ratione dolores corrupti mollitia soluta quia.", 5 "author" : { 6 "state" : "active", 7 "id" : 18, 8 "web_url" : "https://gitlab.example.com/eileen.lowe", 9 "name" : "Alexandra Bashirian", 10 "avatar_url" : null, 11 "username" : "eileen.lowe" 12 }, 13 "milestone" : { 14 "project_id" : 1, 15 "description" : "Ducimus nam enim ex consequatur cumque ratione.", 16 "state" : "closed", 17 "due_date" : null, 18 "iid" : 2, 19 "created_at" : "2016-01-04T15:31:39.996Z", 20 "title" : "v4.0", 21 "id" : 17, 22 "updated_at" : "2016-01-04T15:31:39.996Z" 23 }, 24 "project_id" : 1, 25 "assignees" : [{ 26 "state" : "active", 27 "id" : 1, 28 "name" : "管理员", 29 "web_url" : "https://gitlab.example.com/root", 30 "avatar_url" : null, 31 "username" : "root" 32 }], 33 "assignee" : { 34 "state" : "active", 35 "id" : 1, 36 "name" : "管理员", 37 "web_url" : "https://gitlab.example.com/root", 38 "avatar_url" : null, 39 "username" : "root" 40 }, 41 "type" : "ISSUE", 42 "updated_at" : "2016-01-04T15:31:51.081Z", 43 "closed_at" : null, 44 "closed_by" : null, 45 "id" : 76, 46 "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.", 47 "created_at" : "2016-01-04T15:31:51.081Z", 48 "moved_to_id" : null, 49 "iid" : 6, 50 "labels" : ["foo", "bar"], 51 "upvotes": 4, 52 "downvotes": 0, 53 "merge_requests_count": 0, 54 "user_notes_count": 1, 55 "due_date": "2016-07-22", 56 "imported":false, 57 "imported_from": "none", 58 "web_url": "http://gitlab.example.com/my-group/my-project/issues/6", 59 "references": { 60 "short": "#6", 61 "relative": "my-group/my-project#6", 62 "full": "my-group/my-project#6" 63 }, 64 "time_stats": { 65 "time_estimate": 0, 66 "total_time_spent": 0, 67 "human_time_estimate": null, 68 "human_total_time_spent": null 69 }, 70 "has_tasks": true, 71 "task_status": "10 of 15 tasks completed", 72 "confidential": false, 73 "discussion_locked": false, 74 "issue_type": "issue", 75 "severity": "UNKNOWN", 76 "_links":{ 77 "self":"http://gitlab.example.com/api/v4/projects/1/issues/76", 78 "notes":"http://gitlab.example.com/api/v4/projects/1/issues/76/notes", 79 "award_emoji":"http://gitlab.example.com/api/v4/projects/1/issues/76/award_emoji", 80 "project":"http://gitlab.example.com/api/v4/projects/1", 81 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 82 }, 83 "task_completion_status":{ 84 "count":0, 85 "completed_count":0 86 } 87 } 88]
在极狐GitLab 专业版或旗舰版上创建的议题包括 weight 属性:
json1[ 2 { 3 "state" : "opened", 4 "description" : "Ratione dolores corrupti mollitia soluta quia.", 5 "weight": null, 6 ... 7 } 8]
在极狐GitLab 专业版或旗舰版上创建的议题包括 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上创建的议题包括 health_status 属性:
json1[ 2 { 3 "state" : "opened", 4 "description" : "Ratione dolores corrupti mollitia soluta quia.", 5 "health_status": "on_track", 6 ... 7 } 8]
列出群组议题
获取群组的议题列表。
如果群组是私有的,您必须提供凭据进行授权。首选方式是使用个人访问令牌。
plaintext1GET /groups/:id/issues 2GET /groups/:id/issues?assignee_id=5 3GET /groups/:id/issues?author_id=5 4GET /groups/:id/issues?confidential=true 5GET /groups/:id/issues?iids[]=42&iids[]=43 6GET /groups/:id/issues?labels=foo 7GET /groups/:id/issues?labels=foo,bar 8GET /groups/:id/issues?labels=foo,bar&state=opened 9GET /groups/:id/issues?milestone=1.0.0 10GET /groups/:id/issues?milestone=1.0.0&state=opened 11GET /groups/:id/issues?my_reaction_emoji=star 12GET /groups/:id/issues?search=issue+title+or+description 13GET /groups/:id/issues?state=closed 14GET /groups/:id/issues?state=opened
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 群组的全局 ID 或URL 编码路径。 |
| assignee_id | integer | No | 返回分配给指定用户 id 的议题。与 assignee_username 互斥。 None 返回未分配的议题。 Any 返回有受托人的议题。 |
| assignee_username | string array | No | 返回分配给指定 username 的议题。与 assignee_id 类似并互斥。在极狐GitLab 基础版中,assignee_username 数组只能包含一个值,否则将返回无效参数错误。 |
| author_id | integer | No | 返回由指定用户 id 创建的议题。与 author_username 互斥。结合 scope=all 或 scope=assigned_to_me 使用。 |
| author_username | string | No | 返回由指定 username 创建的议题。与 author_id 类似并互斥。 |
| confidential | boolean | No | 过滤机密或公共议题。 |
| created_after | datetime | No | 返回在指定时间或之后创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| created_before | datetime | No | 返回在指定时间或之前创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| due_date | string | No | 返回没有到期日期、已过期或到期日期为本周、这个月或两周前至下个月之间的议题。接受:0(无到期日期),any,today,tomorrow,overdue,week,month,next_month_and_previous_two_weeks。 |
| epic_id | integer | No | 返回与给定史诗 ID 关联的议题。 None 返回未与史诗关联的议题。 Any 返回与史诗关联的议题。仅适用于专业版和旗舰版。 |
| iids[] | integer array | No | 仅返回具有指定 iid 的议题。 |
| issue_type | string | No | 过滤到指定类型的议题。包括 issue,incident,test_case 或 task。 |
| iteration_id | integer | No | 返回分配给指定迭代 ID 的议题。 None 返回不属于迭代的议题。 Any 返回属于迭代的议题。与 iteration_title 互斥。仅适用于专业版和旗舰版。 |
| iteration_title | string | No | 返回分配给指定标题的迭代的议题。与 iteration_id 类似并互斥。仅适用于专业版和旗舰版。 |
| labels | string | No | 用逗号分隔的标签名称列表,议题必须具有所有标签才能返回。None 列出所有没有标签的议题。Any 列出至少有一个标签的所有议题。No+Label(已弃用)列出所有没有标签的议题。预定义的名称不区分大小写。 |
| milestone | string | No | 里程碑标题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。 |
| my_reaction_emoji | string | No | 返回由经过身份验证的用户通过指定的 emoji 响应的议题。None 返回未给予反应的议题。Any 返回至少给予一个反应的议题。 |
| non_archived | boolean | No | 仅从非存档项目中返回议题。默认值为 true。 |
| not | Hash | No | 返回不符合所提供参数的议题。接受:labels,milestone,author_id,author_username,assignee_id,assignee_username,my_reaction_emoji,search,in。 |
| order_by | string | No | 返回按 created_at,updated_at,priority,due_date,relative_position,label_priority,milestone_due,popularity,weight 字段排序的议题。默认是 created_at。 |
| scope | string | No | 返回指定范围的议题:created_by_me,assigned_to_me 或 all。默认为 all。 |
| search | string | No | 根据群组议题的 title 和 description 搜索议题。 |
| sort | string | No | 返回按 asc 或 desc 顺序排序的议题。默认是 desc。 |
| state | string | No | 返回所有议题或仅返回 opened 或 closed 的议题。 |
| updated_after | datetime | No | 返回在指定时间或之后更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| updated_before | datetime | No | 返回在指定时间或之前更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| weight | integer | No | 返回具有指定 weight 的议题。None 返回没有权重分配的议题。Any 返回有权重分配的议题。仅适用于专业版和旗舰版。 |
| with_labels_details | boolean | No | 如果为 true,响应将返回标签字段中每个标签的更多详细信息::name,:color,:description,:description_html,:text_color。默认是 false。 |
示例请求:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/groups/4/issues"
示例响应:
json1[ 2 { 3 "project_id" : 4, 4 "milestone" : { 5 "due_date" : null, 6 "project_id" : 4, 7 "state" : "closed", 8 "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", 9 "iid" : 3, 10 "id" : 11, 11 "title" : "v3.0", 12 "created_at" : "2016-01-04T15:31:39.788Z", 13 "updated_at" : "2016-01-04T15:31:39.788Z" 14 }, 15 "author" : { 16 "state" : "active", 17 "web_url" : "https://gitlab.example.com/root", 18 "avatar_url" : null, 19 "username" : "root", 20 "id" : 1, 21 "name" : "管理员" 22 }, 23 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 24 "state" : "closed", 25 "iid" : 1, 26 "assignees" : [{ 27 "avatar_url" : null, 28 "web_url" : "https://gitlab.example.com/lennie", 29 "state" : "active", 30 "username" : "lennie", 31 "id" : 9, 32 "name" : "Dr. Luella Kovacek" 33 }], 34 "assignee" : { 35 "avatar_url" : null, 36 "web_url" : "https://gitlab.example.com/lennie", 37 "state" : "active", 38 "username" : "lennie", 39 "id" : 9, 40 "name" : "Dr. Luella Kovacek" 41 }, 42 "type" : "ISSUE", 43 "labels" : ["foo", "bar"], 44 "upvotes": 4, 45 "downvotes": 0, 46 "merge_requests_count": 0, 47 "id" : 41, 48 "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", 49 "updated_at" : "2016-01-04T15:31:46.176Z", 50 "created_at" : "2016-01-04T15:31:46.176Z", 51 "closed_at" : null, 52 "closed_by" : null, 53 "user_notes_count": 1, 54 "due_date": null, 55 "imported": false, 56 "imported_from": "none", 57 "web_url": "http://gitlab.example.com/my-group/my-project/issues/1", 58 "references": { 59 "short": "#1", 60 "relative": "my-project#1", 61 "full": "my-group/my-project#1" 62 }, 63 "time_stats": { 64 "time_estimate": 0, 65 "total_time_spent": 0, 66 "human_time_estimate": null, 67 "human_total_time_spent": null 68 }, 69 "has_tasks": true, 70 "task_status": "10 of 15 tasks completed", 71 "confidential": false, 72 "discussion_locked": false, 73 "issue_type": "issue", 74 "severity": "UNKNOWN", 75 "_links":{ 76 "self":"http://gitlab.example.com/api/v4/projects/4/issues/41", 77 "notes":"http://gitlab.example.com/api/v4/projects/4/issues/41/notes", 78 "award_emoji":"http://gitlab.example.com/api/v4/projects/4/issues/41/award_emoji", 79 "project":"http://gitlab.example.com/api/v4/projects/4", 80 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 81 }, 82 "task_completion_status":{ 83 "count":0, 84 "completed_count":0 85 } 86 } 87]
在极狐GitLab 专业版或旗舰版上创建的议题包括 weight 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "weight": null, 6 ... 7 } 8]
在极狐GitLab 专业版或旗舰版上创建的议题包括 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上创建的议题包括 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "at_risk", 6 ... 7 } 8]
列出项目议题
获取项目的议题列表。
如果项目是私有的,您需要提供凭据进行授权。首选方式是使用个人访问令牌。
plaintext1GET /projects/:id/issues 2GET /projects/:id/issues?assignee_id=5 3GET /projects/:id/issues?author_id=5 4GET /projects/:id/issues?confidential=true 5GET /projects/:id/issues?iids[]=42&iids[]=43 6GET /projects/:id/issues?labels=foo 7GET /projects/:id/issues?labels=foo,bar 8GET /projects/:id/issues?labels=foo,bar&state=opened 9GET /projects/:id/issues?milestone=1.0.0 10GET /projects/:id/issues?milestone=1.0.0&state=opened 11GET /projects/:id/issues?my_reaction_emoji=star 12GET /projects/:id/issues?search=issue+title+or+description 13GET /projects/:id/issues?state=closed 14GET /projects/:id/issues?state=opened
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或URL 编码路径。 |
| assignee_id | integer | No | 返回分配给指定用户 id 的议题。与 assignee_username 互斥。 None 返回未分配的议题。 Any 返回有受托人的议题。 |
| assignee_username | string array | No | 返回分配给指定 username 的议题。与 assignee_id 类似并互斥。在极狐GitLab 基础版中,assignee_username 数组只能包含一个值,否则将返回无效参数错误。 |
| author_id | integer | No | 返回由指定用户 id 创建的议题。与 author_username 互斥。结合 scope=all 或 scope=assigned_to_me 使用。 |
| author_username | string | No | 返回由指定 username 创建的议题。与 author_id 类似并互斥。 |
| confidential | boolean | No | 过滤机密或公共议题。 |
| created_after | datetime | No | 返回在指定时间或之后创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| created_before | datetime | No | 返回在指定时间或之前创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| due_date | string | No | 返回没有到期日期、已过期或到期日期为本周、这个月或两周前至下个月之间的议题。接受:0(无到期日期),any,today,tomorrow,overdue,week,month,next_month_and_previous_two_weeks。 |
| epic_id | integer | No | 返回与给定史诗 ID 关联的议题。 None 返回未与史诗关联的议题。 Any 返回与史诗关联的议题。仅适用于专业版和旗舰版。 |
| iids[] | integer array | No | 仅返回具有指定 iid 的议题。 |
| issue_type | string | No | 过滤到指定类型的议题。包括 issue,incident,test_case 或 task。 |
| iteration_id | integer | No | 返回分配给指定迭代 ID 的议题。 None 返回不属于迭代的议题。 Any 返回属于迭代的议题。与 iteration_title 互斥。仅适用于专业版和旗舰版。 |
| iteration_title | string | No | 返回分配给指定标题的迭代的议题。与 iteration_id 类似并互斥。仅适用于专业版和旗舰版。 |
| labels | string | No | 用逗号分隔的标签名称列表,议题必须具有所有标签才能返回。None 列出所有没有标签的议题。Any 列出至少有一个标签的所有议题。No+Label(已弃用)列出所有没有标签的议题。预定义的名称不区分大小写。 |
| milestone | string | No | 里程碑标题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。 |
| my_reaction_emoji | string | No | 返回由经过身份验证的用户通过指定的 emoji 响应的议题。None 返回未给予反应的议题。Any 返回至少给予一个反应的议题。 |
| not | Hash | No | 返回不符合所提供参数的议题。接受:labels,milestone,author_id,author_username,assignee_id,assignee_username,my_reaction_emoji,search,in。 |
| order_by | string | No | 返回按 created_at,updated_at,priority,due_date,relative_position,label_priority,milestone_due,popularity,weight 字段排序的议题。默认是 created_at。 |
| scope | string | No | 返回指定范围的议题:created_by_me,assigned_to_me 或 all。默认为 all。 |
| search | string | No | 根据项目议题的 title 和 description 搜索议题。 |
| sort | string | No | 返回按 asc 或 desc 顺序排序的议题。默认是 desc。 |
| state | string | No | 返回所有议题或仅返回 opened 或 closed 的议题。 |
| updated_after | datetime | No | 返回在指定时间或之后更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| updated_before | datetime | No | 返回在指定时间或之前更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。 |
| weight | integer | No | 返回具有指定 weight 的议题。None 返回没有权重分配的议题。Any 返回有权重分配的议题。仅适用于专业版和旗舰版。 |
| with_labels_details | boolean | No | 如果为 true,响应将返回标签字段中每个标签的更多详细信息::name,:color,:description,:description_html,:text_color。默认是 false。 |
示例请求:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/issues"
示例响应:
json1[ 2 { 3 "project_id" : 4, 4 "milestone" : { 5 "due_date" : null, 6 "project_id" : 4, 7 "state" : "closed", 8 "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", 9 "iid" : 3, 10 "id" : 11, 11 "title" : "v3.0", 12 "created_at" : "2016-01-04T15:31:39.788Z", 13 "updated_at" : "2016-01-04T15:31:39.788Z" 14 }, 15 "author" : { 16 "state" : "active", 17 "web_url" : "https://gitlab.example.com/root", 18 "avatar_url" : null, 19 "username" : "root", 20 "id" : 1, 21 "name" : "管理员" 22 }, 23 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 24 "state" : "closed", 25 "iid" : 1, 26 "assignees" : [{ 27 "avatar_url" : null, 28 "web_url" : "https://gitlab.example.com/lennie", 29 "state" : "active", 30 "username" : "lennie", 31 "id" : 9, 32 "name" : "Dr. Luella Kovacek" 33 }], 34 "assignee" : { 35 "avatar_url" : null, 36 "web_url" : "https://gitlab.example.com/lennie", 37 "state" : "active", 38 "username" : "lennie", 39 "id" : 9, 40 "name" : "Dr. Luella Kovacek" 41 }, 42 "type" : "ISSUE", 43 "labels" : ["foo", "bar"], 44 "upvotes": 4, 45 "downvotes": 0, 46 "merge_requests_count": 0, 47 "id" : 41, 48 "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", 49 "updated_at" : "2016-01-04T15:31:46.176Z", 50 "created_at" : "2016-01-04T15:31:46.176Z", 51 "closed_at" : "2016-01-05T15:31:46.176Z", 52 "closed_by" : { 53 "state" : "active", 54 "web_url" : "https://gitlab.example.com/root", 55 "avatar_url" : null, 56 "username" : "root", 57 "id" : 1, 58 "name" : "管理员" 59 }, 60 "user_notes_count": 1, 61 "due_date": "2016-07-22", 62 "imported": false, 63 "imported_from": "none", 64 "web_url": "http://gitlab.example.com/my-group/my-project/issues/1", 65 "references": { 66 "short": "#1", 67 "relative": "#1", 68 "full": "my-group/my-project#1" 69 }, 70 "time_stats": { 71 "time_estimate": 0, 72 "total_time_spent": 0, 73 "human_time_estimate": null, 74 "human_total_time_spent": null 75 }, 76 "has_tasks": true, 77 "task_status": "10 of 15 tasks completed", 78 "confidential": false, 79 "discussion_locked": false, 80 "issue_type": "issue", 81 "severity": "UNKNOWN", 82 "_links":{ 83 "self":"http://gitlab.example.com/api/v4/projects/4/issues/41", 84 "notes":"http://gitlab.example.com/api/v4/projects/4/issues/41/notes", 85 "award_emoji":"http://gitlab.example.com/api/v4/projects/4/issues/41/award_emoji", 86 "project":"http://gitlab.example.com/api/v4/projects/4", 87 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 88 }, 89 "task_completion_status":{ 90 "count":0, 91 "completed_count":0 92 } 93 } 94]
在极狐GitLab 专业版或旗舰版上创建的议题包括 weight 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "weight": null, 6 ... 7 } 8]
在极狐GitLab 专业版或旗舰版上创建的议题包括 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上创建的议题包括 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "at_risk", 6 ... 7 } 8]
单个议题
仅适用于管理员。
获取单个议题。
首选方式是使用个人访问令牌。
plaintextGET /issues/:id
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer | Yes | 议题的 ID。 |
示例请求:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/issues/41"
示例响应:
json1{ 2 "id": 1, 3 "milestone": { 4 "due_date": null, 5 "project_id": 4, 6 "state": "closed", 7 "description": "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", 8 "iid": 3, 9 "id": 11, 10 "title": "v3.0", 11 "created_at": "2016-01-04T15:31:39.788Z", 12 "updated_at": "2016-01-04T15:31:39.788Z", 13 "closed_at": "2016-01-05T15:31:46.176Z" 14 }, 15 "author": { 16 "state": "active", 17 "web_url": "https://gitlab.example.com/root", 18 "avatar_url": null, 19 "username": "root", 20 "id": 1, 21 "name": "Administrator" 22 }, 23 "description": "Omnis vero earum sunt corporis dolor et placeat.", 24 "state": "closed", 25 "iid": 1, 26 "assignees": [ 27 { 28 "avatar_url": null, 29 "web_url": "https://gitlab.example.com/lennie", 30 "state": "active", 31 "username": "lennie", 32 "id": 9, 33 "name": "Dr. Luella Kovacek" 34 } 35 ], 36 "assignee": { 37 "avatar_url": null, 38 "web_url": "https://gitlab.example.com/lennie", 39 "state": "active", 40 "username": "lennie", 41 "id": 9, 42 "name": "Dr. Luella Kovacek" 43 }, 44 "type": "ISSUE", 45 "labels": [], 46 "upvotes": 4, 47 "downvotes": 0, 48 "merge_requests_count": 0, 49 "title": "Ut commodi ullam eos dolores perferendis nihil sunt.", 50 "updated_at": "2016-01-04T15:31:46.176Z", 51 "created_at": "2016-01-04T15:31:46.176Z", 52 "closed_at": null, 53 "closed_by": null, 54 "subscribed": false, 55 "user_notes_count": 1, 56 "due_date": null, 57 "imported": false, 58 "imported_from": "none", 59 "web_url": "http://example.com/my-group/my-project/issues/1", 60 "references": { 61 "short": "#1", 62 "relative": "#1", 63 "full": "my-group/my-project#1" 64 }, 65 "time_stats": { 66 "time_estimate": 0, 67 "total_time_spent": 0, 68 "human_time_estimate": null, 69 "human_total_time_spent": null 70 }, 71 "confidential": false, 72 "discussion_locked": false, 73 "issue_type": "issue", 74 "severity": "UNKNOWN", 75 "task_completion_status": { 76 "count": 0, 77 "completed_count": 0 78 }, 79 "weight": null, 80 "has_tasks": false, 81 "_links": { 82 "self": "http://gitlab.example:3000/api/v4/projects/1/issues/1", 83 "notes": "http://gitlab.example:3000/api/v4/projects/1/issues/1/notes", 84 "award_emoji": "http://gitlab.example:3000/api/v4/projects/1/issues/1/award_emoji", 85 "project": "http://gitlab.example:3000/api/v4/projects/1", 86 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 87 }, 88 "moved_to_id": null, 89 "service_desk_reply_to": "service.desk@gitlab.com" 90}
在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 weight 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "weight": null, 5 ... 6}
在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic": { 5 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 6 "epic": { 7 "id" : 42, 8 "iid" : 5, 9 "title": "My epic epic", 10 "url" : "/groups/h5bp/-/epics/5", 11 "group_id": 8 12 }, 13 ... 14}
极狐GitLab 旗舰版用户还可以查看 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "on_track", 6 ... 7 } 8]
单个项目议题
获取单个项目议题。
如果项目是私有的或议题是机密的,您需要提供凭据进行授权。首选的方法是使用个人访问令牌。
plaintextGET /projects/:id/issues/:issue_iid
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | Yes | 项目议题的内部 ID。 |
示例请求:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/issues/41"
示例响应:
json1{ 2 "project_id" : 4, 3 "milestone" : { 4 "due_date" : null, 5 "project_id" : 4, 6 "state" : "closed", 7 "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", 8 "iid" : 3, 9 "id" : 11, 10 "title" : "v3.0", 11 "created_at" : "2016-01-04T15:31:39.788Z", 12 "updated_at" : "2016-01-04T15:31:39.788Z", 13 "closed_at" : "2016-01-05T15:31:46.176Z" 14 }, 15 "author" : { 16 "state" : "active", 17 "web_url" : "https://gitlab.example.com/root", 18 "avatar_url" : null, 19 "username" : "root", 20 "id" : 1, 21 "name" : "Administrator" 22 }, 23 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 24 "state" : "closed", 25 "iid" : 1, 26 "assignees" : [{ 27 "avatar_url" : null, 28 "web_url" : "https://gitlab.example.com/lennie", 29 "state" : "active", 30 "username" : "lennie", 31 "id" : 9, 32 "name" : "Dr. Luella Kovacek" 33 }], 34 "assignee" : { 35 "avatar_url" : null, 36 "web_url" : "https://gitlab.example.com/lennie", 37 "state" : "active", 38 "username" : "lennie", 39 "id" : 9, 40 "name" : "Dr. Luella Kovacek" 41 }, 42 "type" : "ISSUE", 43 "labels" : [], 44 "upvotes": 4, 45 "downvotes": 0, 46 "merge_requests_count": 0, 47 "id" : 41, 48 "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", 49 "updated_at" : "2016-01-04T15:31:46.176Z", 50 "created_at" : "2016-01-04T15:31:46.176Z", 51 "closed_at" : null, 52 "closed_by" : null, 53 "subscribed": false, 54 "user_notes_count": 1, 55 "due_date": null, 56 "imported": false, 57 "imported_from": "none", 58 "web_url": "http://gitlab.example.com/my-group/my-project/issues/1", 59 "references": { 60 "short": "#1", 61 "relative": "#1", 62 "full": "my-group/my-project#1" 63 }, 64 "time_stats": { 65 "time_estimate": 0, 66 "total_time_spent": 0, 67 "human_time_estimate": null, 68 "human_total_time_spent": null 69 }, 70 "confidential": false, 71 "discussion_locked": false, 72 "issue_type": "issue", 73 "severity": "UNKNOWN", 74 "_links": { 75 "self": "http://gitlab.example.com/api/v4/projects/1/issues/2", 76 "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes", 77 "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji", 78 "project": "http://gitlab.example.com/api/v4/projects/1", 79 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 80 }, 81 "task_completion_status":{ 82 "count":0, 83 "completed_count":0 84 } 85}
在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 weight 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "weight": null, 5 ... 6}
在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
极狐GitLab 旗舰版用户还可以看到 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "on_track", 6 ... 7 } 8]
新议题
创建一个新项目议题。
plaintextPOST /projects/:id/issues
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| assignee_id | integer | No | 要分配议题给的用户 ID。仅在极狐GitLab 基础版中出现。 |
| assignee_ids | integer array | No | 要分配议题给的用户 ID。仅限专业版和旗舰版。 |
| confidential | boolean | No | 设置议题为机密。默认值为 false。 |
| created_at | string | No | 议题创建时间。日期时间字符串,ISO 8601 格式,例如 2016-03-11T03:45:40Z。需要管理员或项目/群组拥有者权限。 |
| description | string | No | 议题描述。限制为 1,048,576 个字符。 |
| discussion_to_resolve | string | No | 要解决的讨论 ID。这会使用默认描述填充议题,并将讨论标记为已解决。与 merge_request_to_resolve_discussions_of 结合使用。 |
| due_date | string | No | 到期日期。日期时间字符串,格式为 YYYY-MM-DD,例如 2016-03-11。 |
| epic_id | integer | No | 要添加议题到的史诗 ID。有效值大于或等于 0。仅限专业版和旗舰版。 |
| epic_iid | integer | No | 要添加议题到的史诗 IID。有效值大于或等于 0。(已弃用,计划在 API 版本 5 中删除)。仅限专业版和旗舰版。 |
| iid | integer/string | No | 项目议题的内部 ID(需要管理员或项目拥有者权限)。 |
| issue_type | string | No | 议题类型。可以是 issue、incident、test_case 或 task。默认值为 issue。 |
| labels | string | No | 逗号分隔的标签名称分配给新议题。如果标签尚不存在,则会创建新的项目标签并分配给议题。 |
| merge_request_to_resolve_discussions_of | integer | No | 要解决所有议题的合并请求 IID。这会使用默认描述填充议题,并将所有讨论标记为已解决。传递描述或标题时,这些值优先于默认值。 |
| milestone_id | integer | No | 要分配议题的里程碑的全局 ID。要找到与里程碑关联的 milestone_id,请查看分配了里程碑的议题并使用 API 检索议题详细信息。 |
| title | string | Yes | 议题标题。 |
| weight | integer | No | 议题的权重。有效值大于或等于 0。仅限专业版和旗舰版。 |
示例请求:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug"
示例响应:
json1{ 2 "project_id" : 4, 3 "id" : 84, 4 "created_at" : "2016-01-07T12:44:33.959Z", 5 "iid" : 14, 6 "title" : "Issues with auth", 7 "state" : "opened", 8 "assignees" : [], 9 "assignee" : null, 10 "type" : "ISSUE", 11 "labels" : [ 12 "bug" 13 ], 14 "upvotes": 4, 15 "downvotes": 0, 16 "merge_requests_count": 0, 17 "author" : { 18 "name" : "Alexandra Bashirian", 19 "avatar_url" : null, 20 "state" : "active", 21 "web_url" : "https://gitlab.example.com/eileen.lowe", 22 "id" : 18, 23 "username" : "eileen.lowe" 24 }, 25 "description" : null, 26 "updated_at" : "2016-01-07T12:44:33.959Z", 27 "closed_at" : null, 28 "closed_by" : null, 29 "milestone" : null, 30 "subscribed" : true, 31 "user_notes_count": 0, 32 "due_date": null, 33 "web_url": "http://gitlab.example.com/my-group/my-project/issues/14", 34 "references": { 35 "short": "#14", 36 "relative": "#14", 37 "full": "my-group/my-project#14" 38 }, 39 "time_stats": { 40 "time_estimate": 0, 41 "total_time_spent": 0, 42 "human_time_estimate": null, 43 "human_total_time_spent": null 44 }, 45 "confidential": false, 46 "discussion_locked": false, 47 "issue_type": "issue", 48 "severity": "UNKNOWN", 49 "_links": { 50 "self": "http://gitlab.example.com/api/v4/projects/1/issues/2", 51 "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes", 52 "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji", 53 "project": "http://gitlab.example.com/api/v4/projects/1", 54 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 55 }, 56 "task_completion_status":{ 57 "count":0, 58 "completed_count":0 59 } 60}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:
json1{ 2 "project_id" : 4, 3 "description" : null, 4 "weight": null, 5 ... 6}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "on_track", 6 ... 7 } 8]
速率限制
为帮助避免滥用,用户可以被限制为每分钟特定数量的 Create 请求。请参阅议题速率限制。
编辑议题
更新现有项目议题。此请求也用于关闭或重新打开议题(使用 state_event)。
请求成功至少需要以下参数之一:
- :assignee_id
- :assignee_ids
- :confidential
- :created_at
- :description
- :discussion_locked
- :due_date
- :issue_type
- :labels
- :milestone_id
- :state_event
- :title
plaintextPUT /projects/:id/issues/:issue_iid
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | Yes | 项目议题的内部 ID。 |
| add_labels | string | No | 逗号分隔的标签名称添加到议题。如果标签尚不存在,则会创建新的项目标签并分配给议题。 |
| assignee_ids | integer array | No | 要分配议题给的用户 ID。设置为 0 或提供空值以取消分配所有受让人。 |
| confidential | boolean | No | 更新议题为机密。 |
| description | string | No | 议题描述。限制为 1,048,576 个字符。 |
| discussion_locked | boolean | No | Flag indicating if the issue's discussion is locked. If the discussion is locked only project members can add or edit comments. |
| due_date | string | No | 到期日期。日期时间字符串,格式为 YYYY-MM-DD,例如 2016-03-11。 |
| epic_id | integer | No | 要将议题添加到的史诗的 ID。有效值大于或等于 0。仅限专业版和旗舰版。 |
| epic_iid | integer | No | 要将议题添加到的史诗的 IID。有效值大于或等于 0。(已弃用,计划在 API 版本 5 中移除)。仅限专业版和旗舰版。 |
| issue_type | string | No | 更新议题的类型。可以是 issue、incident、test_case 或 task 之一。 |
| labels | string | No | 议题的逗号分隔标签名称。设置为空字符串以取消分配所有标签。如果标签不存在,则创建新的项目标签并将其分配给议题。 |
| milestone_id | integer | No | 要分配议题的里程碑的全局 ID。设置为 0 或提供空值以取消分配里程碑。 |
| remove_labels | string | No | 逗号分隔的标签名称从议题中删除。 |
| state_event | string | No | 议题的状态事件。要关闭议题,请使用 close,要重新打开,请使用 reopen。 |
| title | string | No | 议题标题。 |
| updated_at | string | No | 议题更新时间。日期时间字符串,ISO 8601 格式,例如 2016-03-11T03:45:40Z(需要管理员或项目拥有者权限)。空字符串或空值不被接受。 |
| weight | integer | No | 议题的权重。有效值大于或等于 0。仅限专业版和旗舰版。 |
示例请求:
shellcurl --request PUT \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close"
示例响应:
json1{ 2 "created_at" : "2016-01-07T12:46:01.410Z", 3 "author" : { 4 "name" : "Alexandra Bashirian", 5 "avatar_url" : null, 6 "username" : "eileen.lowe", 7 "id" : 18, 8 "state" : "active", 9 "web_url" : "https://gitlab.example.com/eileen.lowe" 10 }, 11 "state" : "closed", 12 "title" : "Issues with auth", 13 "project_id" : 4, 14 "description" : null, 15 "updated_at" : "2016-01-07T12:55:16.213Z", 16 "closed_at" : "2016-01-08T12:55:16.213Z", 17 "closed_by" : { 18 "state" : "active", 19 "web_url" : "https://gitlab.example.com/root", 20 "avatar_url" : null, 21 "username" : "root", 22 "id" : 1, 23 "name" : "Administrator" 24 }, 25 "iid" : 15, 26 "labels" : [ 27 "bug" 28 ], 29 "upvotes": 4, 30 "downvotes": 0, 31 "merge_requests_count": 0, 32 "id" : 85, 33 "assignees" : [], 34 "assignee" : null, 35 "milestone" : null, 36 "subscribed" : true, 37 "user_notes_count": 0, 38 "due_date": "2016-07-22", 39 "web_url": "http://gitlab.example.com/my-group/my-project/issues/15", 40 "references": { 41 "short": "#15", 42 "relative": "#15", 43 "full": "my-group/my-project#15" 44 }, 45 "time_stats": { 46 "time_estimate": 0, 47 "total_time_spent": 0, 48 "human_time_estimate": null, 49 "human_total_time_spent": null 50 }, 51 "confidential": false, 52 "discussion_locked": false, 53 "issue_type": "issue", 54 "severity": "UNKNOWN", 55 "_links": { 56 "self": "http://gitlab.example.com/api/v4/projects/1/issues/2", 57 "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes", 58 "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji", 59 "project": "http://gitlab.example.com/api/v4/projects/1", 60 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 61 62 }, 63 "task_completion_status":{ 64 "count":0, 65 "completed_count":0 66 } 67}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:
json1{ 2 "project_id" : 4, 3 "description" : null, 4 "weight": null, 5 ... 6}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "on_track", 6 ... 7 } 8]
删除议题
仅限管理员和项目所有者。
删除议题。
plaintextDELETE /projects/:id/issues/:issue_iid
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | Yes | 项目议题的内部 ID。 |
示例请求:
shellcurl --request DELETE \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/issues/85"
如果成功,返回 204 No Content。
重新排序议题
重新排序议题。您可以在手动排序议题时看到结果。
plaintextPUT /projects/:id/issues/:issue_iid/reorder
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | Yes | 项目议题的内部 ID。 |
| move_after_id | integer | No | 项目议题的全局 ID,应放在此议题之后。 |
| move_before_id | integer | No | 项目议题的全局 ID,应放在此议题之前。 |
示例请求:
shellcurl --request PUT \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/4/issues/85/reorder?move_after_id=51&move_before_id=92"
移动议题
将议题移动到不同项目。如果目标项目是源项目或用户权限不足,则返回状态码 400 的错误消息。
如果目标项目中存在具有相同名称的标签或里程碑,则将其分配给正在移动的议题。
plaintextPOST /projects/:id/issues/:issue_iid/move
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | Yes | 项目议题的内部 ID。 |
| to_project_id | integer | Yes | 新项目的 ID。 |
示例请求:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --form to_project_id=5 \ --url "https://gitlab.example.com/api/v4/projects/4/issues/85/move"
示例响应:
json1{ 2 "id": 92, 3 "iid": 11, 4 "project_id": 5, 5 "title": "Sit voluptas tempora quisquam aut doloribus et.", 6 "description": "Repellat voluptas quibusdam voluptatem exercitationem.", 7 "state": "opened", 8 "created_at": "2016-04-05T21:41:45.652Z", 9 "updated_at": "2016-04-07T12:20:17.596Z", 10 "closed_at": null, 11 "closed_by": null, 12 "labels": [], 13 "upvotes": 4, 14 "downvotes": 0, 15 "merge_requests_count": 0, 16 "milestone": null, 17 "assignees": [{ 18 "name": "Miss Monserrate Beier", 19 "username": "axel.block", 20 "id": 12, 21 "state": "active", 22 "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", 23 "web_url": "https://gitlab.example.com/axel.block" 24 }], 25 "assignee": { 26 "name": "Miss Monserrate Beier", 27 "username": "axel.block", 28 "id": 12, 29 "state": "active", 30 "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", 31 "web_url": "https://gitlab.example.com/axel.block" 32 }, 33 "type" : "ISSUE", 34 "author": { 35 "name": "Kris Steuber", 36 "username": "solon.cremin", 37 "id": 10, 38 "state": "active", 39 "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon", 40 "web_url": "https://gitlab.example.com/solon.cremin" 41 }, 42 "due_date": null, 43 "imported": false, 44 "imported_from": "none", 45 "web_url": "http://gitlab.example.com/my-group/my-project/issues/11", 46 "references": { 47 "short": "#11", 48 "relative": "#11", 49 "full": "my-group/my-project#11" 50 }, 51 "time_stats": { 52 "time_estimate": 0, 53 "total_time_spent": 0, 54 "human_time_estimate": null, 55 "human_total_time_spent": null 56 }, 57 "confidential": false, 58 "discussion_locked": false, 59 "issue_type": "issue", 60 "severity": "UNKNOWN", 61 "_links": { 62 "self": "http://gitlab.example.com/api/v4/projects/1/issues/2", 63 "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes", 64 "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji", 65 "project": "http://gitlab.example.com/api/v4/projects/1", 66 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 67 }, 68 "task_completion_status":{ 69 "count":0, 70 "completed_count":0 71 } 72}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:
json1{ 2 "project_id": 5, 3 "description": "Repellat voluptas quibusdam voluptatem exercitationem.", 4 "weight": null, 5 ... 6}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "on_track", 6 ... 7 } 8]
克隆议题
将议题克隆到指定项目。尽可能复制数据,只要目标项目包含等效标准,例如标签或里程碑。
如果权限不足,则返回状态码 400 的错误消息。
plaintextPOST /projects/:id/issues/:issue_iid/clone
支持的属性:
示例请求:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/1/clone?with_notes=true&to_project_id=6"
示例响应:
json1{ 2 "id":290, 3 "iid":1, 4 "project_id":143, 5 "title":"foo", 6 "description":"closed", 7 "state":"opened", 8 "created_at":"2021-09-14T22:24:11.696Z", 9 "updated_at":"2021-09-14T22:24:11.696Z", 10 "closed_at":null, 11 "closed_by":null, 12 "labels":[ 13 14 ], 15 "milestone":null, 16 "assignees":[ 17 { 18 "id":179, 19 "name":"John Doe2", 20 "username":"john", 21 "state":"active", 22 "avatar_url":"https://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80\u0026d=identicon", 23 "web_url":"https://gitlab.example.com/john" 24 } 25 ], 26 "author":{ 27 "id":179, 28 "name":"John Doe2", 29 "username":"john", 30 "state":"active", 31 "avatar_url":"https://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80\u0026d=identicon", 32 "web_url":"https://gitlab.example.com/john" 33 }, 34 "type":"ISSUE", 35 "assignee":{ 36 "id":179, 37 "name":"John Doe2", 38 "username":"john", 39 "state":"active", 40 "avatar_url":"https://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80\u0026d=identicon", 41 "web_url":"https://gitlab.example.com/john" 42 }, 43 "user_notes_count":1, 44 "merge_requests_count":0, 45 "upvotes":0, 46 "downvotes":0, 47 "due_date":null, 48 "imported":false, 49 "imported_from": "none", 50 "confidential":false, 51 "discussion_locked":null, 52 "issue_type":"issue", 53 "severity": "UNKNOWN", 54 "web_url":"https://gitlab.example.com/namespace1/project2/-/issues/1", 55 "time_stats":{ 56 "time_estimate":0, 57 "total_time_spent":0, 58 "human_time_estimate":null, 59 "human_total_time_spent":null 60 }, 61 "task_completion_status":{ 62 "count":0, 63 "completed_count":0 64 }, 65 "blocking_issues_count":0, 66 "has_tasks":false, 67 "_links":{ 68 "self":"https://gitlab.example.com/api/v4/projects/143/issues/1", 69 "notes":"https://gitlab.example.com/api/v4/projects/143/issues/1/notes", 70 "award_emoji":"https://gitlab.example.com/api/v4/projects/143/issues/1/award_emoji", 71 "project":"https://gitlab.example.com/api/v4/projects/143", 72 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 73 }, 74 "references":{ 75 "short":"#1", 76 "relative":"#1", 77 "full":"namespace1/project2#1" 78 }, 79 "subscribed":true, 80 "moved_to_id":null, 81 "service_desk_reply_to":null 82}
通知
以下请求与议题的电子邮件通知相关。
订阅议题
订阅经过身份验证的用户以接收议题通知。如果用户已订阅议题,则返回状态码 304。
plaintextPOST /projects/:id/issues/:issue_iid/subscribe
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | Yes | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | Yes | 项目议题的内部 ID。 |
示例请求:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe"
示例响应:
json1{ 2 "id": 92, 3 "iid": 11, 4 "project_id": 5, 5 "title": "Sit voluptas tempora quisquam aut doloribus et.", 6 "description": "Repellat voluptas quibusdam voluptatem exercitationem.", 7 "state": "opened", 8 "created_at": "2016-04-05T21:41:45.652Z", 9 "updated_at": "2016-04-07T12:20:17.596Z", 10 "closed_at": null, 11 "closed_by": null, 12 "labels": [], 13 "upvotes": 4, 14 "downvotes": 0, 15 "merge_requests_count": 0, 16 "milestone": null, 17 "assignees": [{ 18 "name": "Miss Monserrate Beier", 19 "username": "axel.block", 20 "id": 12, 21 "state": "active", 22 "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", 23 "web_url": "https://gitlab.example.com/axel.block" 24 }], 25 "assignee": { 26 "name": "Miss Monserrate Beier", 27 "username": "axel.block", 28 "id": 12, 29 "state": "active", 30 "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", 31 "web_url": "https://gitlab.example.com/axel.block" 32 }, 33 "type" : "ISSUE", 34 "author": { 35 "name": "Kris Steuber", 36 "username": "solon.cremin", 37 "id": 10, 38 "state": "active", 39 "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon", 40 "web_url": "https://gitlab.example.com/solon.cremin" 41 }, 42 "due_date": null, 43 "web_url": "http://gitlab.example.com/my-group/my-project/issues/11", 44 "references": { 45 "short": "#11", 46 "relative": "#11", 47 "full": "my-group/my-project#11" 48 }, 49 "time_stats": { 50 "time_estimate": 0, 51 "total_time_spent": 0, 52 "human_time_estimate": null, 53 "human_total_time_spent": null 54 }, 55 "confidential": false, 56 "discussion_locked": false, 57 "issue_type": "issue", 58 "severity": "UNKNOWN", 59 "_links": { 60 "self": "http://gitlab.example.com/api/v4/projects/1/issues/2", 61 "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes", 62 "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji", 63 "project": "http://gitlab.example.com/api/v4/projects/1", 64 "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75" 65 }, 66 "task_completion_status":{ 67 "count":0, 68 "completed_count":0 69 } 70}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:
json1{ 2 "project_id": 5, 3 "description": "Repellat voluptas quibusdam voluptatem exercitationem.", 4 "weight": null, 5 ... 6}
在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:
json1{ 2 "project_id" : 4, 3 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 4 "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute 5 "epic": { 6 "id" : 42, 7 "iid" : 5, 8 "title": "My epic epic", 9 "url" : "/groups/h5bp/-/epics/5", 10 "group_id": 8 11 }, 12 ... 13}
在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:
json1[ 2 { 3 "project_id" : 4, 4 "description" : "Omnis vero earum sunt corporis dolor et placeat.", 5 "health_status": "on_track", 6 ... 7 } 8]
取消订阅议题
取消认证用户对该议题的订阅,以不接收来自它的通知。如果用户未订阅该议题,则返回状态码 304。
plaintextPOST /projects/:id/issues/:issue_iid/unsubscribe
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe"
响应示例:
json1{ 2 "id": 93, 3 "iid": 12, 4 "project_id": 5, 5 "title": "Incidunt et rerum ea expedita iure quibusdam.", 6 "description": "Et cumque architecto sed aut ipsam.", 7 "state": "opened", 8 "created_at": "2016-04-05T21:41:45.217Z", 9 "updated_at": "2016-04-07T13:02:37.905Z", 10 "labels": [], 11 "upvotes": 4, 12 "downvotes": 0, 13 "merge_requests_count": 0, 14 "milestone": null, 15 "assignee": { 16 "name": "Edwardo Grady", 17 "username": "keyon", 18 "id": 21, 19 "state": "active", 20 "avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon", 21 "web_url": "https://gitlab.example.com/keyon" 22 }, 23 "type" : "ISSUE", 24 "closed_at": null, 25 "closed_by": null, 26 "author": { 27 "name": "Vivian Hermann", 28 "username": "orville", 29 "id": 11, 30 "state": "active", 31 "avatar_url": "http://www.gravatar.com/avatar/5224fd70153710e92fb8bcf79ac29d67?s=80&d=identicon", 32 "web_url": "https://gitlab.example.com/orville" 33 }, 34 "subscribed": false, 35 "due_date": null, 36 "web_url": "http://gitlab.example.com/my-group/my-project/issues/12", 37 "references": { 38 "short": "#12", 39 "relative": "#12", 40 "full": "my-group/my-project#12" 41 }, 42 "confidential": false, 43 "discussion_locked": false, 44 "issue_type": "issue", 45 "severity": "UNKNOWN", 46 "task_completion_status":{ 47 "count":0, 48 "completed_count":0 49 } 50}
创建待办事项
手动为当前用户在议题上创建待办事项。如果用户在该议题上已经存在待办事项,则返回状态码 304。
plaintextPOST /projects/:id/issues/:issue_iid/todo
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/todo"
响应示例:
json1{ 2 "id": 112, 3 "project": { 4 "id": 5, 5 "name": "极狐GitLab CI/CD", 6 "name_with_namespace": "极狐GitLab Org / 极狐GitLab CI/CD", 7 "path": "gitlab-ci", 8 "path_with_namespace": "gitlab-org/gitlab-ci" 9 }, 10 "author": { 11 "name": "管理员", 12 "username": "root", 13 "id": 1, 14 "state": "active", 15 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", 16 "web_url": "https://gitlab.example.com/root" 17 }, 18 "action_name": "marked", 19 "target_type": "Issue", 20 "target": { 21 "id": 93, 22 "iid": 10, 23 "project_id": 5, 24 "title": "Vel voluptas atque dicta mollitia adipisci qui at.", 25 "description": "Tempora laboriosam sint magni sed voluptas similique.", 26 "state": "closed", 27 "created_at": "2016-06-17T07:47:39.486Z", 28 "updated_at": "2016-07-01T11:09:13.998Z", 29 "labels": [], 30 "milestone": { 31 "id": 26, 32 "iid": 1, 33 "project_id": 5, 34 "title": "v0.0", 35 "description": "Accusantium nostrum rerum quae quia quis nesciunt suscipit id.", 36 "state": "closed", 37 "created_at": "2016-06-17T07:47:33.832Z", 38 "updated_at": "2016-06-17T07:47:33.832Z", 39 "due_date": null 40 }, 41 "assignees": [{ 42 "name": "Jarret O'Keefe", 43 "username": "francisca", 44 "id": 14, 45 "state": "active", 46 "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon", 47 "web_url": "https://gitlab.example.com/francisca" 48 }], 49 "assignee": { 50 "name": "Jarret O'Keefe", 51 "username": "francisca", 52 "id": 14, 53 "state": "active", 54 "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon", 55 "web_url": "https://gitlab.example.com/francisca" 56 }, 57 "type" : "ISSUE", 58 "author": { 59 "name": "Maxie Medhurst", 60 "username": "craig_rutherford", 61 "id": 12, 62 "state": "active", 63 "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", 64 "web_url": "https://gitlab.example.com/craig_rutherford" 65 }, 66 "subscribed": true, 67 "user_notes_count": 7, 68 "upvotes": 0, 69 "downvotes": 0, 70 "merge_requests_count": 0, 71 "due_date": null, 72 "web_url": "http://gitlab.example.com/my-group/my-project/issues/10", 73 "references": { 74 "short": "#10", 75 "relative": "#10", 76 "full": "my-group/my-project#10" 77 }, 78 "confidential": false, 79 "discussion_locked": false, 80 "issue_type": "issue", 81 "severity": "UNKNOWN", 82 "task_completion_status":{ 83 "count":0, 84 "completed_count":0 85 } 86 }, 87 "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/issues/10", 88 "body": "Vel voluptas atque dicta mollitia adipisci qui at.", 89 "state": "pending", 90 "created_at": "2016-07-01T11:09:13.992Z" 91}
将议题提升为史诗
- Tier: 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
通过添加带有 /promote 的评论,将议题提升为史诗 快速操作。
有关将议题提升为史诗的更多信息,请参阅 将议题提升为史诗。
plaintextPOST /projects/:id/issues/:issue_iid/notes
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
| body | String | 是 | 注释的内容。必须在新行的开头包含 /promote。如果注释仅包含 /promote,则提升议题,但不添加评论。否则,其他行形成评论。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=Lets%20promote%20this%20to%20an%20epic%0A%0A%2Fpromote"
响应示例:
json1{ 2 "id":699, 3 "type":null, 4 "body":"Lets promote this to an epic", 5 "attachment":null, 6 "author": { 7 "id":1, 8 "name":"Alexandra Bashirian", 9 "username":"eileen.lowe", 10 "state":"active", 11 "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", 12 "web_url":"https://gitlab.example.com/eileen.lowe" 13 }, 14 "created_at":"2020-12-03T12:27:17.844Z", 15 "updated_at":"2020-12-03T12:27:17.844Z", 16 "system":false, 17 "noteable_id":461, 18 "noteable_type":"Issue", 19 "resolvable":false, 20 "confidential":false, 21 "noteable_iid":33, 22 "commands_changes": { 23 "promote_to_epic":true 24 } 25}
时间跟踪
以下请求与议题的 时间跟踪 相关。
为议题设置时间估算
为此议题设置预估工作时间。
plaintextPOST /projects/:id/issues/:issue_iid/time_estimate
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| duration | string | 是 | 人类可读格式的持续时间。例如:3h30m。 |
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m"
响应示例:
json1{ 2 "human_time_estimate": "3h 30m", 3 "human_total_time_spent": null, 4 "time_estimate": 12600, 5 "total_time_spent": 0 6}
重置议题的时间估算
将此议题的预估时间重置为 0 秒。
plaintextPOST /projects/:id/issues/:issue_iid/reset_time_estimate
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate"
响应示例:
json1{ 2 "human_time_estimate": null, 3 "human_total_time_spent": null, 4 "time_estimate": 0, 5 "total_time_spent": 0 6}
为议题添加已用时间
为此议题添加已用时间。
plaintextPOST /projects/:id/issues/:issue_iid/add_spent_time
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| duration | string | 是 | 人类可读格式的持续时间。例如:3h30m |
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
| summary | string | 否 | 时间如何花费的摘要。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h"
响应示例:
json1{ 2 "human_time_estimate": null, 3 "human_total_time_spent": "1h", 4 "time_estimate": 0, 5 "total_time_spent": 3600 6}
重置议题的已用时间
将此议题的总已用时间重置为 0 秒。
plaintextPOST /projects/:id/issues/:issue_iid/reset_spent_time
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time"
响应示例:
json1{ 2 "human_time_estimate": null, 3 "human_total_time_spent": null, 4 "time_estimate": 0, 5 "total_time_spent": 0 6}
获取时间跟踪统计
以人类可读的格式(例如,1h30m)和秒数获取议题的时间跟踪统计。
如果项目是私有的或议题是机密的,您必须提供凭据进行授权。推荐的方式是使用 个人访问令牌。
plaintextGET /projects/:id/issues/:issue_iid/time_stats
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats"
响应示例:
json1{ 2 "human_time_estimate": "2h", 3 "human_total_time_spent": "1h", 4 "time_estimate": 7200, 5 "total_time_spent": 3600 6}
合并请求
以下请求与议题和合并请求之间的关系有关。
列出与议题相关的合并请求
获取与议题相关的所有合并请求。
如果项目是私有的或议题是机密的,您需要提供凭据进行授权。推荐的方式是使用 个人访问令牌。
plaintextGET /projects/:id/issues/:issue_iid/related_merge_requests
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests"
响应示例:
json1[ 2 { 3 "id": 29, 4 "iid": 11, 5 "project_id": 1, 6 "title": "Provident eius eos blanditiis consequatur neque odit.", 7 "description": "Ut consequatur ipsa aspernatur quisquam voluptatum fugit. Qui harum corporis quo fuga ut incidunt veritatis. Autem necessitatibus et harum occaecati nihil ea.\r\n\r\ntwitter/flight#8", 8 "state": "opened", 9 "created_at": "2018-09-18T14:36:15.510Z", 10 "updated_at": "2018-09-19T07:45:13.089Z", 11 "closed_by": null, 12 "closed_at": null, 13 "target_branch": "v2.x", 14 "source_branch": "so_long_jquery", 15 "user_notes_count": 9, 16 "upvotes": 0, 17 "downvotes": 0, 18 "author": { 19 "id": 14, 20 "name": "Verna Hills", 21 "username": "lawanda_reinger", 22 "state": "active", 23 "avatar_url": "https://www.gravatar.com/avatar/de68a91aeab1cff563795fb98a0c2cc0?s=80&d=identicon", 24 "web_url": "https://gitlab.example.com/lawanda_reinger" 25 }, 26 "assignee": { 27 "id": 19, 28 "name": "Jody Baumbach", 29 "username": "felipa.kuvalis", 30 "state": "active", 31 "avatar_url": "https://www.gravatar.com/avatar/6541fc75fc4e87e203529bd275fafd07?s=80&d=identicon", 32 "web_url": "https://gitlab.example.com/felipa.kuvalis" 33 }, 34 "source_project_id": 1, 35 "target_project_id": 1, 36 "labels": [], 37 "draft": false, 38 "work_in_progress": false, 39 "milestone": { 40 "id": 27, 41 "iid": 2, 42 "project_id": 1, 43 "title": "v1.0", 44 "description": "Et tenetur voluptatem minima doloribus vero dignissimos vitae.", 45 "state": "active", 46 "created_at": "2018-09-18T14:35:44.353Z", 47 "updated_at": "2018-09-18T14:35:44.353Z", 48 "due_date": null, 49 "start_date": null, 50 "web_url": "https://gitlab.example.com/twitter/flight/milestones/2" 51 }, 52 "merge_when_pipeline_succeeds": false, 53 "merge_status": "cannot_be_merged", 54 "sha": "3b7b528e9353295c1c125dad281ac5b5deae5f12", 55 "merge_commit_sha": null, 56 "squash_commit_sha": null, 57 "discussion_locked": null, 58 "should_remove_source_branch": null, 59 "force_remove_source_branch": false, 60 "reference": "!11", 61 "web_url": "https://gitlab.example.com/twitter/flight/merge_requests/4", 62 "references": { 63 "short": "!4", 64 "relative": "!4", 65 "full": "twitter/flight!4" 66 }, 67 "time_stats": { 68 "time_estimate": 0, 69 "total_time_spent": 0, 70 "human_time_estimate": null, 71 "human_total_time_spent": null 72 }, 73 "squash": false, 74 "task_completion_status": { 75 "count": 0, 76 "completed_count": 0 77 }, 78 "changes_count": "10", 79 "latest_build_started_at": "2018-12-05T01:16:41.723Z", 80 "latest_build_finished_at": "2018-12-05T02:35:54.046Z", 81 "first_deployed_to_production_at": null, 82 "pipeline": { 83 "id": 38980952, 84 "sha": "81c6a84c7aebd45a1ac2c654aa87f11e32338e0a", 85 "ref": "test-branch", 86 "status": "success", 87 "web_url": "https://jihulab.com/gitlab-cn/gitlab/pipelines/38980952" 88 }, 89 "head_pipeline": { 90 "id": 38980952, 91 "sha": "81c6a84c7aebd45a1ac2c654aa87f11e32338e0a", 92 "ref": "test-branch", 93 "status": "success", 94 "web_url": "https://gitlab.example.com/twitter/flight/pipelines/38980952", 95 "before_sha": "3c738a37eb23cf4c0ed0d45d6ddde8aad4a8da51", 96 "tag": false, 97 "yaml_errors": null, 98 "user": { 99 "id": 19, 100 "name": "Jody Baumbach", 101 "username": "felipa.kuvalis", 102 "state": "active", 103 "avatar_url": "https://www.gravatar.com/avatar/6541fc75fc4e87e203529bd275fafd07?s=80&d=identicon", 104 "web_url": "https://gitlab.example.com/felipa.kuvalis" 105 }, 106 "created_at": "2018-12-05T01:16:13.342Z", 107 "updated_at": "2018-12-05T02:35:54.086Z", 108 "started_at": "2018-12-05T01:16:41.723Z", 109 "finished_at": "2018-12-05T02:35:54.046Z", 110 "committed_at": null, 111 "duration": 4436, 112 "coverage": "46.68", 113 "detailed_status": { 114 "icon": "status_warning", 115 "text": "passed", 116 "label": "passed with warnings", 117 "group": "success-with-warnings", 118 "tooltip": "passed", 119 "has_details": true, 120 "details_path": "/twitter/flight/pipelines/38", 121 "illustration": null, 122 "favicon": "https://gitlab.example.com/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png" 123 } 124 }, 125 "diff_refs": { 126 "base_sha": "d052d768f0126e8cddf80afd8b1eb07f406a3fcb", 127 "head_sha": "81c6a84c7aebd45a1ac2c654aa87f11e32338e0a", 128 "start_sha": "d052d768f0126e8cddf80afd8b1eb07f406a3fcb" 129 }, 130 "merge_error": null, 131 "user": { 132 "can_merge": true 133 } 134 } 135]
列出合并时关闭特定议题的合并请求
获取所有在合并时关闭特定议题的合并请求。
如果项目是私有的或议题是机密的,您需要提供凭据进行授权。推荐的方式是使用 个人访问令牌。
plaintextGET /projects/:id/issues/:issue_iid/closed_by
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by"
响应示例:
json1[ 2 { 3 "id": 6471, 4 "iid": 6432, 5 "project_id": 1, 6 "title": "add a test for cgi lexer options", 7 "description": "closes #11", 8 "state": "opened", 9 "created_at": "2017-04-06T18:33:34.168Z", 10 "updated_at": "2017-04-09T20:10:24.983Z", 11 "target_branch": "main", 12 "source_branch": "feature.custom-highlighting", 13 "upvotes": 0, 14 "downvotes": 0, 15 "author": { 16 "name": "管理员", 17 "username": "root", 18 "id": 1, 19 "state": "active", 20 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", 21 "web_url": "https://gitlab.example.com/root" 22 }, 23 "assignee": null, 24 "source_project_id": 1, 25 "target_project_id": 1, 26 "closed_at": null, 27 "closed_by": null, 28 "labels": [], 29 "draft": false, 30 "work_in_progress": false, 31 "milestone": null, 32 "merge_when_pipeline_succeeds": false, 33 "merge_status": "unchecked", 34 "sha": "5a62481d563af92b8e32d735f2fa63b94e806835", 35 "merge_commit_sha": null, 36 "squash_commit_sha": null, 37 "user_notes_count": 1, 38 "should_remove_source_branch": null, 39 "force_remove_source_branch": false, 40 "web_url": "https://gitlab.example.com/gitlab-org/gitlab-test/merge_requests/6432", 41 "reference": "!6432", 42 "references": { 43 "short": "!6432", 44 "relative": "!6432", 45 "full": "gitlab-org/gitlab-test!6432" 46 }, 47 "time_stats": { 48 "time_estimate": 0, 49 "total_time_spent": 0, 50 "human_time_estimate": null, 51 "human_total_time_spent": null 52 } 53 } 54]
列出议题的参与者
列出议题中的参与用户。
如果项目是私有的或议题是机密的,您需要提供凭据进行授权。推荐的方式是使用 个人访问令牌。
plaintextGET /projects/:id/issues/:issue_iid/participants
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/participants"
响应示例:
json1[ 2 { 3 "id": 1, 4 "name": "John Doe1", 5 "username": "user1", 6 "state": "active", 7 "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon", 8 "web_url": "http://gitlab.example.com/user1" 9 }, 10 { 11 "id": 5, 12 "name": "John Doe5", 13 "username": "user5", 14 "state": "active", 15 "avatar_url": "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon", 16 "web_url": "http://gitlab.example.com/user5" 17 } 18]
议题上的评论
使用 Notes API 进行评论交互。
获取用户代理详情
仅对管理员可用。
获取创建议题的用户的用户代理字符串和 IP,用于垃圾邮件跟踪。
plaintextGET /projects/:id/issues/:issue_iid/user_agent_detail
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail"
响应示例:
json{ "user_agent": "AppleWebKit/537.36", "ip_address": "127.0.0.1", "akismet_submitted": false }
列出议题状态事件
要跟踪设置了哪个状态、谁设置的以及何时发生的,请使用 资源状态事件 API。
事件
以下请求仅适用于 事件。
上传指标图像
仅适用于 事件。
上传指标图表的截图以显示在事件的 指标 标签页中。上传图像时,可以将图像与文本或链接到原始图表关联。如果添加了 URL,可以通过选择上传图像上方的超链接来访问原始图表。
plaintextPOST /projects/:id/issues/:issue_iid/metric_images
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
| file | file | 是 | 要上传的图像文件。 |
| url | string | 否 | 查看更多指标信息的 URL。 |
| url_text | string | 否 | 图像或 URL 的描述。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --form 'file=@/path/to/file.png' \ --form 'url=http://example.com' \ --form 'url_text=Example website' \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images"
响应示例:
json1{ 2 "id": 23, 3 "created_at": "2020-11-13T00:06:18.084Z", 4 "filename": "file.png", 5 "file_path": "/uploads/-/system/issuable_metric_image/file/23/file.png", 6 "url": "http://example.com", 7 "url_text": "Example website" 8}
列出指标图像
仅适用于 事件。
列出事件的 指标 标签页中显示的指标图表的截图。
plaintextGET /projects/:id/issues/:issue_iid/metric_images
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images"
响应示例:
json1[ 2 { 3 "id": 17, 4 "created_at": "2020-11-12T20:07:58.156Z", 5 "filename": "sample_2054", 6 "file_path": "/uploads/-/system/issuable_metric_image/file/17/sample_2054.png", 7 "url": "example.com/metric" 8 }, 9 { 10 "id": 18, 11 "created_at": "2020-11-12T20:14:26.441Z", 12 "filename": "sample_2054", 13 "file_path": "/uploads/-/system/issuable_metric_image/file/18/sample_2054.png", 14 "url": "example.com/metric" 15 } 16]
更新指标图像
仅适用于 事件。
编辑在事件的 指标 标签页中显示的指标图表截图的属性。
plaintextPUT /projects/:id/issues/:issue_iid/metric_images/:image_id
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
| image_id | integer | 是 | 图像的 ID。 |
| url | string | 否 | 查看更多指标信息的 URL。 |
| url_text | string | 否 | 图像或 URL 的描述。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --request PUT \ --form 'url=http://example.com' \ --form 'url_text=Example website' \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images/1"
响应示例:
json1{ 2 "id": 23, 3 "created_at": "2020-11-13T00:06:18.084Z", 4 "filename": "file.png", 5 "file_path": "/uploads/-/system/issuable_metric_image/file/23/file.png", 6 "url": "http://example.com", 7 "url_text": "Example website" 8}
删除指标图像
仅适用于 事件。
删除在事件的 指标 标签页中显示的指标图表的截图。
plaintextDELETE /projects/:id/issues/:issue_iid/metric_images/:image_id
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的全局 ID 或 URL 编码路径。 |
| issue_iid | integer | 是 | 项目议题的内部 ID。 |
| image_id | integer | 是 | 图像的 ID。 |
请求示例:
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --request DELETE \ --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images/1"
可返回以下状态码:
- 204 No Content,如果图像删除成功。
- 400 Bad Request,如果图像无法删除。
textundefined