项目议题看板 API
- Tier: 基础版, 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
每次调用议题板的 API 都必须经过身份验证。
如果用户不是私有项目的成员,对该项目进行 GET 请求将导致返回 404 状态码。
列出项目议题板
列出给定项目中的项目议题板。
plaintextGET /projects/:id/boards
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards"
示例响应:
json1[ 2 { 3 "id" : 1, 4 "name": "board1", 5 "hide_backlog_list": false, 6 "hide_closed_list": false, 7 "project": { 8 "id": 5, 9 "name": "Diaspora Project Site", 10 "name_with_namespace": "Diaspora / Diaspora Project Site", 11 "path": "diaspora-project-site", 12 "path_with_namespace": "diaspora/diaspora-project-site", 13 "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", 14 "web_url": "http://example.com/diaspora/diaspora-project-site" 15 }, 16 "milestone": { 17 "id": 12, 18 "title": "10.0" 19 }, 20 "lists" : [ 21 { 22 "id" : 1, 23 "label" : { 24 "name" : "Testing", 25 "color" : "#F0AD4E", 26 "description" : null 27 }, 28 "position" : 1, 29 "max_issue_count": 0, 30 "max_issue_weight": 0, 31 "limit_metric": null 32 }, 33 { 34 "id" : 2, 35 "label" : { 36 "name" : "Ready", 37 "color" : "#FF0000", 38 "description" : null 39 }, 40 "position" : 2, 41 "max_issue_count": 0, 42 "max_issue_weight": 0, 43 "limit_metric": null 44 }, 45 { 46 "id" : 3, 47 "label" : { 48 "name" : "Production", 49 "color" : "#FF5F00", 50 "description" : null 51 }, 52 "position" : 3, 53 "max_issue_count": 0, 54 "max_issue_weight": 0, 55 "limit_metric": null 56 } 57 ] 58 } 59]
没有激活或不存在于项目中的板的另一个示例响应:
json[]
显示单个议题板
获取单个项目议题板。
plaintextGET /projects/:id/boards/:board_id
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1"
示例响应:
json1 { 2 "id": 1, 3 "name": "project issue board", 4 "hide_backlog_list": false, 5 "hide_closed_list": false, 6 "project": { 7 "id": 5, 8 "name": "Diaspora Project Site", 9 "name_with_namespace": "Diaspora / Diaspora Project Site", 10 "path": "diaspora-project-site", 11 "path_with_namespace": "diaspora/diaspora-project-site", 12 "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", 13 "web_url": "http://example.com/diaspora/diaspora-project-site" 14 }, 15 "milestone": { 16 "id": 12, 17 "title": "10.0" 18 }, 19 "lists" : [ 20 { 21 "id" : 1, 22 "label" : { 23 "name" : "Testing", 24 "color" : "#F0AD4E", 25 "description" : null 26 }, 27 "position" : 1, 28 "max_issue_count": 0, 29 "max_issue_weight": 0, 30 "limit_metric": null 31 }, 32 { 33 "id" : 2, 34 "label" : { 35 "name" : "Ready", 36 "color" : "#FF0000", 37 "description" : null 38 }, 39 "position" : 2, 40 "max_issue_count": 0, 41 "max_issue_weight": 0, 42 "limit_metric": null 43 }, 44 { 45 "id" : 3, 46 "label" : { 47 "name" : "Production", 48 "color" : "#FF5F00", 49 "description" : null 50 }, 51 "position" : 3, 52 "max_issue_count": 0, 53 "max_issue_weight": 0, 54 "limit_metric": null 55 } 56 ] 57 }
创建一个议题板
创建一个项目议题板。
plaintextPOST /projects/:id/boards
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| name | string | yes | 新板的名称。 |
shellcurl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards?name=newboard"
示例响应:
json1 { 2 "id": 1, 3 "name": "newboard", 4 "hide_backlog_list": false, 5 "hide_closed_list": false, 6 "project": { 7 "id": 5, 8 "name": "Diaspora Project Site", 9 "name_with_namespace": "Diaspora / Diaspora Project Site", 10 "path": "diaspora-project-site", 11 "path_with_namespace": "diaspora/diaspora-project-site", 12 "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", 13 "web_url": "http://example.com/diaspora/diaspora-project-site" 14 }, 15 "lists" : [], 16 "group": null, 17 "milestone": null, 18 "assignee" : null, 19 "labels" : [], 20 "weight" : null 21 }
更新议题板
更新项目议题板。
plaintextPUT /projects/:id/boards/:board_id
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
| name | string | no | 板的新名称。 |
| hide_backlog_list | boolean | no | 隐藏打开的列表。 |
| hide_closed_list | boolean | no | 隐藏关闭的列表。 |
| assignee_id | integer | no | 板应限定的负责人。仅限专业版和旗舰版。 |
| milestone_id | integer | no | 板应限定的里程碑。仅限专业版和旗舰版。 |
| labels | string | no | 以逗号分隔的标签名称列表,板应限定。仅限专业版和旗舰版。 |
| weight | integer | no | 权重范围从 0 到 9,板应限定。仅限专业版和旗舰版。 |
shellcurl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1?name=new_name&milestone_id=43&assignee_id=1&labels=Doing&weight=4"
示例响应:
json1 { 2 "id": 1, 3 "name": "new_name", 4 "hide_backlog_list": false, 5 "hide_closed_list": false, 6 "project": { 7 "id": 5, 8 "name": "Diaspora Project Site", 9 "name_with_namespace": "Diaspora / Diaspora Project Site", 10 "path": "diaspora-project-site", 11 "path_with_namespace": "diaspora/diaspora-project-site", 12 "created_at": "2018-07-03T05:48:49.982Z", 13 "default_branch": null, 14 "tag_list": [], //deprecated, use `topics` instead 15 "topics": [], 16 "ssh_url_to_repo": "ssh://user@example.com/diaspora/diaspora-project-site.git", 17 "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", 18 "web_url": "http://example.com/diaspora/diaspora-project-site", 19 "readme_url": null, 20 "avatar_url": null, 21 "star_count": 0, 22 "forks_count": 0, 23 "last_activity_at": "2018-07-03T05:48:49.982Z" 24 }, 25 "lists": [], 26 "group": null, 27 "milestone": { 28 "id": 43, 29 "iid": 1, 30 "project_id": 15, 31 "title": "Milestone 1", 32 "description": "Milestone 1 desc", 33 "state": "active", 34 "created_at": "2018-07-03T06:36:42.618Z", 35 "updated_at": "2018-07-03T06:36:42.618Z", 36 "due_date": null, 37 "start_date": null, 38 "web_url": "http://example.com/root/board1/milestones/1" 39 }, 40 "assignee": { 41 "id": 1, 42 "name": "Administrator", 43 "username": "root", 44 "state": "active", 45 "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", 46 "web_url": "http://example.com/root" 47 }, 48 "labels": [{ 49 "id": 10, 50 "name": "Doing", 51 "color": "#5CB85C", 52 "description": null 53 }], 54 "weight": 4 55 }
删除议题板
删除项目议题板。
plaintextDELETE /projects/:id/boards/:board_id
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
shellcurl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1"
列出项目议题板中的板列表
获取板列表。不包括 open 和 closed 列表。
plaintextGET /projects/:id/boards/:board_id/lists
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1/lists"
示例响应:
json1[ 2 { 3 "id" : 1, 4 "label" : { 5 "name" : "Testing", 6 "color" : "#F0AD4E", 7 "description" : null 8 }, 9 "position" : 1, 10 "max_issue_count": 0, 11 "max_issue_weight": 0, 12 "limit_metric": null 13 }, 14 { 15 "id" : 2, 16 "label" : { 17 "name" : "Ready", 18 "color" : "#FF0000", 19 "description" : null 20 }, 21 "position" : 2, 22 "max_issue_count": 0, 23 "max_issue_weight": 0, 24 "limit_metric": null 25 }, 26 { 27 "id" : 3, 28 "label" : { 29 "name" : "Production", 30 "color" : "#FF5F00", 31 "description" : null 32 }, 33 "position" : 3, 34 "max_issue_count": 0, 35 "max_issue_weight": 0, 36 "limit_metric": null 37 } 38]
显示单个板列表
获取单个板列表。
plaintextGET /projects/:id/boards/:board_id/lists/:list_id
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
| list_id | integer | yes | 板列表的 ID。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1/lists/1"
示例响应:
json1{ 2 "id" : 1, 3 "label" : { 4 "name" : "Testing", 5 "color" : "#F0AD4E", 6 "description" : null 7 }, 8 "position" : 1, 9 "max_issue_count": 0, 10 "max_issue_weight": 0, 11 "limit_metric": null 12}
创建板列表
创建新的议题板列表。
plaintextPOST /projects/:id/boards/:board_id/lists
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
| label_id | integer | no | 标签的 ID。 |
| assignee_id | integer | no | 用户的 ID。仅限专业版和旗舰版。 |
| milestone_id | integer | no | 里程碑的 ID。仅限专业版和旗舰版。 |
| iteration_id | integer | no | 迭代的 ID。仅限专业版和旗舰版。 |
标签、负责人和里程碑参数是互斥的,即请求中只接受其中一个。查看[议题板文档](../user/project/issue_board.md)以获取有关每个列表类型所需许可证的更多信息。
shellcurl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1/lists?label_id=5"
示例响应:
json1{ 2 "id" : 1, 3 "label" : { 4 "name" : "Testing", 5 "color" : "#F0AD4E", 6 "description" : null 7 }, 8 "position" : 1, 9 "max_issue_count": 0, 10 "max_issue_weight": 0, 11 "limit_metric": null 12}
重新排序板中的列表
更新现有议题板列表。此调用用于更改列表位置。
plaintextPUT /projects/:id/boards/:board_id/lists/:list_id
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
| list_id | integer | yes | 板列表的 ID。 |
| position | integer | yes | 列表的位置。 |
shellcurl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1/lists/1?position=2"
示例响应:
json1{ 2 "id" : 1, 3 "label" : { 4 "name" : "Testing", 5 "color" : "#F0AD4E", 6 "description" : null 7 }, 8 "position" : 1, 9 "max_issue_count": 0, 10 "max_issue_weight": 0, 11 "limit_metric": null 12}
从板中删除板列表
仅限管理员和项目所有者。删除板列表。
plaintextDELETE /projects/:id/boards/:board_id/lists/:list_id
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码路径。 |
| board_id | integer | yes | 板的 ID。 |
| list_id | integer | yes | 板列表的 ID。 |
shellcurl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/boards/1/lists/1"