Issues 接口文档
1. 创建Issue
请求
POST https://api.gitcode.com/api/v5/repos/{owner}/issues
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径 | formData | string |
title* | Issue标题 | formData | string |
body | Issue描述 | formData | string |
assignee | Issue负责人的username | formData | string |
milestone | 里程碑序号 | formData | integer |
labels | 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | formData | string |
security_hole | 是否是私有issue(默认为false) | formData | string |
issue_stage | 严重程序(Accepted,Coding,Completed,New,Rejected,Revising,Testing,Verified) | formData | string |
issue_severity | 优先级 (Suggestion,Minor,Major,Fatal) | formData | string |
响应
{
"id": 152642,
"html_url": "https://test.gitcode.net/dengmengmian/test01/issues/15",
"number": 15,
"state": "opened",
"title": "半月据",
"body": "节油料被引系活力级少本化段维家住实。常气前步证时第样日所阶效温界到量。个导土机技亲布接增论始高世收圆流级集。此般区才听党机达两收文斗公加白。代军前分写第图美市与道及间。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"assignee": null,
"repository": {
"id": 152642,
"full_name": "dengmengmian/test01",
"path": "test01",
"name": "test01",
"description": "",
"created_at": "2024-04-18T14:35:15.479+08:00",
"updated_at": "2024-04-18T14:35:15.479+08:00"
},
"created_at": "2024-04-18T14:35:15.479+08:00",
"updated_at": "2024-04-18T14:35:15.479+08:00",
"finished_at": null,
"labels": [
{
"id": 382379,
"name": "enim",
"color": "#428BCA"
},
{
"id": 382378,
"name": "proident",
"color": "#428BCA"
},
{
"id": 382377,
"name": "qui",
"color": "#428BCA"
}
],
"stage": "New",
"severity": "Major"
}
2. 更新Issue
请求
PATCH https://api.gitcode.com/api/v5/repos/{owner}/issues/{number}
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径 | formData | string |
number* | Issue 编号(区分大小写,无需添加 # 号) | path | string |
title | Issue标题 | formData | string |
body | Issue描述 | formData | string |
state | Issue 状态,open(开启的)、closed(关闭的) | formData | string |
assignee | Issue负责人的 username | formData | string |
milestone | 里程碑序号 | formData | integer |
labels | 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | formData | string |
security_hole | 是否是私有issue(默认为false) | formData | string |
issue_stage | 严重程序(Accepted,Coding,Completed,New,Rejected,Revising,Testing,Verified) | formData | string |
issue_severity | 优先级 (Suggestion,Minor,Major,Fatal) | formData | string |
响应
{
"id": 152467,
"html_url": "https://test.gitcode.net/dengmengmian/test01/issues/14",
"number": 14,
"state": "closed",
"title": "取属且阶",
"body": "速军间问备题意自系建技至速。那照与受证们老则使六么信。联不格决白转数特先到接单备心样本及。比论受感此中成要则片会受争里领周局。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"assignee": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"repository": {
"id": 152467,
"full_name": "dengmengmian/test01",
"path": "test01",
"name": "test01",
"description": "",
"created_at": "2024-04-16T14:38:43.464+08:00",
"updated_at": "2024-04-18T18:27:21.955+08:00"
},
"created_at": "2024-04-16T14:38:43.464+08:00",
"updated_at": "2024-04-18T18:27:21.955+08:00",
"finished_at": "2024-04-16T14:49:45.166+08:00",
"labels": [
{
"id": 382389,
"name": "ad",
"color": "#428BCA"
},
{
"id": 382388,
"name": "id",
"color": "#428BCA"
}
],
"stage": "New",
"severity": "Major"
}
3. 获取仓库的某个Issue
请求
GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/{number}
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
number* | Issue 编号(区分大小写,无需添加 # 号) | path | string |
响应
{
"id": 152212,
"html_url": "https://test.gitcode.net/dengmengmian/test01/issues/3",
"number": 3,
"state": "opened",
"title": "查员种金交片",
"body": "而很资七图数指反系并物众示易今高。运边月发红条亲才调二心点上米面世其分。由众计比维选作小指件每酸一见基历。向九又中国层合感内两米或自很转的。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"assignee": null,
"repository": {
"id": 280713,
"full_name": "dengmengmian / test01",
"path": "test01",
"name": "test01",
"description": "",
"created_at": "2024-04-15T16:27:45.090+08:00",
"updated_at": "2024-04-15T16:27:45.090+08:00",
"assigner": null,
"pushed_at": null,
"paas": null,
"assignees_number": null,
"testers_number": null,
"assignee": null,
"testers": null
},
"created_at": "2024-04-15T21:58:21.188+08:00",
"updated_at": "2024-04-15T21:58:21.188+08:00",
"finished_at": null,
"labels": [],
"priority": null,
"issue_type": null,
"issue_state": "opened",
"issue_state_detail": null,
"stage": "New",
"severity": "Major"
}
4. 获取仓库所有 issues
请求
GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
state | Issue的状态: open(开启的), closed(关闭的)。 默认: open | query | string |
labels | 用逗号分开的标签。如: bug,performance | query | string |
sort | 排序依据: 创建时间(created),更新时间(updated_at)。默认: created_at | query | string |
direction | 排序方式: 升序(asc),降序(desc)。默认: desc | query | string |
since | 起始的更新时间,要求时间格式为 ISO 8601 | query | string |
page | 当前的页码 | query | integer |
per_page | 每页的数量,最大为 100 | query | integer |
created_at | 任务创建时间,格式同上 | query | string |
finished_at | 任务完成时间,即任务最后一次转为已完成状态的时间点。格式同上 | query | string |
milestone | 根据里程碑标题。none为没里程碑的,*为所有带里程碑的 | query | string |
assignee | Issue指派人ID | query | string |
creator | 创建Issues的用户username | query | string |
响应
[
{
"id": 152642,
"html_url": "https://test.gitcode.net/dengmengmian/test01/issues/15",
"number": 15,
"state": "opened",
"title": "半月据",
"body": "节油料被引系活力级少本化段维家住实。常气前步证时第样日所阶效温界到量。个导土机技亲布接增论始高世收圆流级集。此般区才听党机达两收文斗公加白。代军前分写第图美市与道及间。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"assignee": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"repository": {
"id": 280713,
"full_name": "dengmengmian / test01",
"path": "test01",
"name": "test01",
"description": "",
"created_at": "2024-04-15T16:27:45.090+08:00",
"updated_at": "2024-04-15T16:27:45.090+08:00",
"assigner": null,
"pushed_at": null,
"paas": null,
"assignees_number": null,
"testers_number": null,
"assignee": null,
"testers": null
},
"created_at": "2024-04-18T14:35:15.479+08:00",
"updated_at": "2024-04-20T15:20:30.111+08:00",
"finished_at": null,
"labels": [
{
"id": 382379,
"name": "enim",
"color": "#428BCA"
},
{
"id": 382378,
"name": "proident",
"color": "#428BCA"
},
{
"id": 382377,
"name": "qui",
"color": "#428BCA"
}
],
"priority": null,
"issue_type": null,
"issue_state": "opened",
"issue_state_detail": null
},
{
"id": 152467,
"html_url": "https://test.gitcode.net/dengmengmian/test01/issues/14",
"number": 14,
"state": "closed",
"title": "取属且阶",
"body": "速军间问备题意自系建技至速。那照与受证们老则使六么信。联不格决白转数特先到接单备心样本及。比论受感此中成要则片会受争里领周局。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"assignee": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"repository": {
"id": 280713,
"full_name": "dengmengmian / test01",
"path": "test01",
"name": "test01",
"description": "",
"created_at": "2024-04-15T16:27:45.090+08:00",
"updated_at": "2024-04-15T16:27:45.090+08:00",
"assigner": null,
"pushed_at": null,
"paas": null,
"assignees_number": null,
"testers_number": null,
"assignee": null,
"testers": null
},
"created_at": "2024-04-16T14:38:43.464+08:00",
"updated_at": "2024-04-18T18:27:21.955+08:00",
"finished_at": "2024-04-16T14:49:45.166+08:00",
"labels": [
{
"id": 382389,
"name": "ad",
"color": "#428BCA"
},
{
"id": 382388,
"name": "id",
"color": "#428BCA"
}
],
"priority": null,
"issue_type": null,
"issue_state": "closed",
"issue_state_detail": null
}
]
5. 获取仓库某个Issue所有的评论
请求
GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/{number}/comments
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token | 用户授权码 | query | string |
owner* | 仓库所属空间地址(企业、组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
number* | Issue 编号(区分大小写,无需添加 # 号) | path | string |
since | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ | query | string |
page | 当前的页码 | query | integer |
per_page | 每页的数量,最大为 100 | query | integer |
order | 排序顺序: asc(default),desc | query | string |
响应
[
{
"id": 271624,
"body": "评论内容。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"target": {
"issue": {
"id": 152134,
"title": "",
"nubmer": 1
}
},
"created_at": "2024-04-19T17:50:18.199+08:00",
"updated_at": "2024-04-19T17:50:18.199+08:00"
}
]
6. 获取仓库所有 iusse 评论
请求 暂无
GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/comments
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token | 用户授权码 | query | string |
owner* | 仓库所属空间地址(企业、组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
sort | Either created or updated. Default: created | query | string |
direction | Either asc or desc. Ignored without the sort parameter. | query | string |
since | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ | query | string |
page | 当前的页码 | query | integer |
per_page | 每页的数量,最大为 100 | query | integer |
响应
[
{
"id": 272201,
"body": "daetete",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"target": {
"issue": {
"id": 152642,
"title": "半月据",
"nubmer": 15
}
},
"created_at": "2024-04-20T15:20:30.104+08:00",
"updated_at": null
}
]
7. 获取 issue 关联的 pull requests
请求 暂无
GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/{number}/pull_requests
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token | 用户授权码 | query | string |
owner* | 仓库所属空间地址(企业、组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | query | string |
number* | Issue 编号(区分大小写,无需添加 # 号) | path | string |
响应
[
{
"id": 67585,
"html_url": "https://api.gitcode.net/test/test/merge_requests/1",
"diff_url": "https://api.gitcode.net/test/test/merge_requests/1/diffs",
"number": 1,
"state": "opened",
"title": "1",
"body": "new: 新增文件 test.txt 1",
"created_at": "2024-04-12T17:50:55.253+08:00",
"updated_at": "2024-04-20T15:58:30.657+08:00",
"merged_at": null,
"closed_at": null,
"head": {
"ref": "develop",
"sha": "061c446d55aae78c7a0f096b2d2dd0d6a1afb170",
"repo": {
"path": "paopao1",
"name": "paopao1"
},
"assigner": {
"login": "test",
"name": "test"
}
},
"base": {
"ref": "main",
"sha": "667d4ac032b2faa13d019753ac218b4f78338273",
"repo": {
"path": "paopao1",
"name": "paopao1"
},
"assigner": null
},
"assignees": [
{
"id": "65803cddcf1e2d1aa3d2e99f",
"login": "test",
"name": null,
"avatar_url": null,
"html_url": "https://api.gitcode.net/test"
}
],
"testers": [
{
"id": "65803cddcf1e2d1aa3d2e99f",
"login": "test",
"name": "test",
"avatar_url": null,
"html_url": "https://api.gitcode.net/test"
}
],
"labels": [
{
"id": 383707,
"color": "#CCCCCC",
"name": "wontfix",
"repository_id": null,
"url": null,
"created_at": "2024-04-19",
"updated_at": "2024-04-19",
"text_color": "#333333"
}
]
}
]
8.获取企业某个Issue所有标签
请求
GET https://api.gitcode.com/api/v5/enterprises/{enterprise}/issues/{number}/labels
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token | 用户授权码 | query | string |
enterprise* | 企业名(path) | path | string |
number* | Issue 编号(区分大小写,无需添加 # 号) | path | string |
page | 当前的页码 | query | integer |
per_page | 每页的数量,最大为 100 | query | integer |
响应
[
{
"color": "#008672",
"name": "help wanted",
"id": 381445,
"title": "help wanted",
"type": null,
"textColor": "#FFFFFF"
}
]
9.创建Issue标签
请求
POST https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/{number}/labels
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
number* | issue编号 | path | string |
labels* | 添加的标签 如: [“feat”, “bug”] | body | array |
响应
[
{
"color": "#008672",
"name": "help wanted",
"id": 381445,
"title": "help wanted",
"type": null,
"textColor": "#FFFFFF"
}
]
10.删除Issue标签
请求
DELETE https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/{number}/labels/{name}
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
number* | 第几个PR,即本仓库PR的序数 | path | string |
name* | 标签名称(批量删除用英文逗号分隔,如: bug,feature) | path | string |
响应
204
11.创建Issue评论
请求
POST https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/{number}/comments
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
number* | issue编号 | path | string |
body* | The contents of the comment. | formdata | string |
响应
{
"id": 271624,
"body": "评论内容。",
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"target": {
"issue": {
"id": 152134,
"title": "",
"nubmer": 1
}
},
"created_at": null,
"updated_at": null
}
12.获取某个issue下的操作日志
请求
GET https://api.gitcode.com/api/v5/repos/{owner}/issues/{number}/operate_logs
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | query | string |
number* | issue编号 | path | string |
响应
[
{
"id": 272199,
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"content": "Create issue mr links: **new: 新增文件 1.text** #1",
"created_at": "2024-04-20T15:20:24.009+08:00",
"action_type": "add_issue_mr_link",
"update_at": "2024-04-20T15:20:24.009+08:00",
"title": "new: 新增文件 1.text",
"body": "new: 新增文件 1.text ",
"head": {
"ref": "develop",
"sha": "dd954d3a779edc86dae5b4b60c7f24dd0f195bf4",
"repo": {
"path": "test01",
"name": "test01"
},
"assigner": {
"login": "dengmengmian",
"name": "麻凡_"
}
},
"base": {
"ref": "main",
"sha": "32cff0d8faaa0c044d0f94957e656051986e8403",
"repo": {
"path": "test01",
"name": "test01"
},
"assigner": null
},
"issue_id": "152642"
},
{
"id": 272198,
"user": {
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
"events_url": null,
"followers_url": null,
"following_url": null,
"gists_url": null,
"html_url": "https://test.gitcode.net/dengmengmian",
"id": "661ce4eab470b1430d456154",
"login": "dengmengmian",
"member_role": null,
"name": "麻凡_",
"organizations_url": null,
"received_events_url": null,
"remark": null,
"repos_url": null,
"starred_url": null,
"subscriptions_url": null,
"type": null,
"url": null
},
"content": "changed milestone to testew",
"created_at": "2024-04-20T15:20:09.305+08:00",
"action_type": "milestone",
"update_at": "2024-04-20T15:20:09.305+08:00",
"title": null,
"body": null,
"head": null,
"base": null,
"issue_id": "152642"
}
]
13.获取某个企业的所有Issues
请求
GET https://api.gitcode.com/api/v5/enterprises/{enterprise}/issues
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token | 用户授权码 | query | string |
owner* | 仓库所属空间地址(企业、组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
refs* | 起点名称,默认:master | formData | string |
branch_name* | 新创建的分支名称 | formData | string |
name* | 仓库名称 | formData | string |
enterprise* | 企业的路径(path/login) | path | string |
state | Issue的状态: open(开启的), progressing(进行中), closed(关闭的), rejected(拒绝的)。 默认: open | query | string |
labels | 用逗号分开的标签。如: bug,performance | query | string |
sort | 排序依据: 创建时间(created),更新时间(updated_at)。默认: created_at | query | string |
direction | 排序方式: 升序(asc),降序(desc)。默认: desc | query | string |
since | 起始的更新时间,要求时间格式为 ISO 8601 | query | string |
page | 当前的页码 | query | integer |
per_page | 每页的数量,最大为 100 | query | integer |
schedule | 计划开始日期,格式:20181006T173008+80-20181007T173008+80(区间),或者 -20181007T173008+80(小于20181007T173008+80),或者 20181006T173008+80-(大于20181006T173008+80),要求时间格式为20181006T173008+80 | query | string |
deadline | 计划截止日期,格式同上 | query | string |
created_at | 任务创建时间,格式同上 | query | string |
finished_at | 任务完成时间,即任务最后一次转为已完成状态的时间点。格式同上 | query | string |
milestone | 根据里程碑标题。none为没里程碑的,*为所有带里程碑的 | query | string |
assignee | 用户的username。 none为没指派者, *为所有带有指派者的 | query | string |
creator | 创建Issues的用户username | query | string |
program | 所属项目名称。none为没所属有项目的,*为所有带所属项目的 | query | string |
响应
[
{
"id": 484445,
"html_url": "https://gitcode.com/Hello_worldsss/IK_001_01/issues/42",
"number": "42",
"state": "open",
"title": "1221",
"body": "### 故障现象描述\n \n1212\n### 负责团队\n \n项目中心\n### 发现环境\n \n测试环境(.net)\n### 重要程度\n \n一般\n### 领域\n \n性能\n### 优先级\n \n中\n### 处理人\n \n王占分\n### 测试人员\n \n杜鑫\n### 故障复现步骤\n \n\n### F12查看错误码\n \n\n",
"assignee": {
"avatar_url": "https://cdn-img.gitcode.com/db/cf/dbc07f37245cab6693ef7a3ba7eb101634f480c263fa294f6b366e4a0fe60a45.png?time=1720429708203",
"html_url": "https://gitcode.com/yinlin",
"id": "303745",
"login": "yinlin",
"name": "yinlin-昵称",
"type": "User"
}
}
]
Demo
curl --location --request GET 'https://api.gitcode.com/api/v5/enterprises/Hello_worldsss/issues?state=open&direction=desc&page=1&per_page=20&access_token=xxxx&sort=created_at' \
14 获取授权用户的所有Issues
请求
GET https://api.gitcode.com/api/v5/user/issues
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token | 用户授权码 | query | string |
owner* | 仓库所属空间地址(企业、组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
refs* | 起点名称,默认:master | formData | string |
branch_name* | 新创建的分支名称 | formData | string |
name* | 仓库名称 | formData | string |
filter | 筛选参数: 授权用户负责的(assigned),授权用户创建的(created),包含前两者的(all)。默认: assigned | query | string |
state | Issue的状态: open(开启的), progressing(进行中), closed(关闭的), rejected(拒绝的)。默认: open | query | string |
labels | 用逗号分开的标签。如: bug,performance | query | string |
sort | 排序依据: 创建时间(created),更新时间(updated_at)。默认: created_at | query | string |
direction | 排序方式: 升序(asc),降序(desc)。默认: desc | query | string |
since | 起始的更新时间,要求时间格式为 ISO 8601 | query | string |
page | 当前的页码 | query | integer |
per_page | 每页的数量,最大为 100 | query | integer |
schedule | 计划开始日期,格式:20181006T173008+80-20181007T173008+80(区间),或者 -20181007T173008+80(小于20181007T173008+80),或者 20181006T173008+80-(大于20181006T173008+80),要求时间格式为20181006T173008+80 | query | string |
deadline | 计划截止日期,格式同上 | query | string |
created_at | 任务创建时间,格式同上 | query | string |
finished_at | 任务完成时间,即任务最后一次转为已完成状态的时间点。格式同上 | query | string |
响应
[
{
"id": 490786,
"html_url": "https://gitcode.com/gitcode-dev/gitcode-TestTask/issues/319",
"number": "319",
"state": "open",
"title": "评论中附件图片的大小从 2M 放开到 10M,允许用户上传更大尺寸的图片附件",
"body": "### 提测内容\n \n如题: https://gitcode.com/gitcode-dev/releases-log/issues/617\n### 需求文档地址\n \nhttps://gitcode.com/gitcode-dev/releases-log/issues/617\n### UI设计图地址\n \n无\n### 技术方案地址\n \n无\n### 影响范围\n \n\n### 涉及上线服务\n \ngitcode-fe\n### 研发人员\n \n刘奥林\n### pr文件改动diffs\n \nhttps://gitcode.com/gitcode-dev/gitcode-fe/merge_requests/3661/diffs\n### 依赖项\n \n\n### API调整\n \n\n### 数据库调整\n \n\n### nacos配置调整\n \n\n### 运维调整\n \n\n",
"assignee": {
"avatar_url": "https://cdn-img.gitcode.com/db/cf/dbc07f37245cab6693ef7a3ba7eb101634f480c263fa294f6b366e4a0fe60a45.png?time=1720429708203",
"html_url": "https://gitcode.com/yinlin",
"id": "303745",
"login": "yinlin",
"name": "yinlin-昵称",
"type": "User"
},
}
]
Demo
curl --location --request GET 'https://api.gitcode.com/api/v5/issues?access_token=xxx=created_at&direction=desc&page=1&per_page=20' \
16 更新Issue某条评论
请求
PATCH https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/comments/{id}
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
id* | 评论 ID | path | string |
body* | formDate | string |
响应
{
"id": 1486664,
"body": "1111112222222",
"comment_type": "DiscussionNote",
"user": {
"id": "303745",
"login": "yinlin",
"name": "yinlin-昵称",
"type": "User"
},
"target": {
"issue": {
"id": 478892,
"title": "1111",
"number": "478892"
}
},
"created_at": "2024-09-27T14:58:51+08:00",
"updated_at": "2024-09-27T14:58:51+08:00"
}
Demo
curl --location --request PATCH 'https://api.gitcode.com/api/v5/repos/Hello_worldsss/IK_001_01/pulls/comments/1478704?access_token=xxx' \
--header 'Content-Type: application/json' \
--data '{
"body":"0913更新评论"
}'
17 删除Issue某条评论
请求
PATCH https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/comments/{id}
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
id* | 评论 ID | path | string |
响应
Demo
curl --location --request DELETE 'https://api.gitcode.com/api/v5/repos/Hello_worldsss/IK_001_01/issues/comments/1486664?access_token=xxx'
18 获取仓库Issue某条评论
请求
GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/issues/comments/{id}
参数
参数名 | 描述 | 类型 | 数据类型 |
---|---|---|---|
access_token* | 用户授权码 | query | string |
owner* | 仓库所属空间地址(组织或个人的地址path) | path | string |
repo* | 仓库路径(path) | path | string |
id* | 评论 ID | path | string |
响应
{
"id": 1495484,
"body": "测试 issue 评论",
"comment_type": "DiscussionNote",
"user": {
"id": "268",
"login": "dengmengmian",
"name": "麻凡",
"type": "User"
},
"target": {
"issue": {
"id": 494561,
"title": "测试 issue 评论",
"number": "494561"
}
},
"created_at": "2024-10-08T19:52:19+08:00",
"updated_at": "2024-10-08T19:52:19+08:00"
}
Demo
curl --location -g --request GET 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/issues/comments/1495484?access_token=yuBy'