route_id: route_version: current_version: repo_commit: 524b1f7da1b2fef3b224719868efccf9947770ca date: 2026-10-12 21:39:10 description: 用户调用此接口,进行获取某个企业的所有Issues操作. lang: zh
获取某个企业的所有Issues¶
GET /api/v5/enterprises/{enterprise}/issues
该接口用于获取指定企业的全部 Issue 列表,支持按状态、标签、里程碑、指派者、创建者及关键字等条件筛选,并可对结果进行排序和分页,便于批量查看与管理企业内的问题。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
enterprise |
path | string | 是 | 企业的路径(path/login) |
state |
query | string | 否 | Issue的状态:open(开启的)、closed(关闭的)、all(所有);默认 open |
labels |
query | string | 否 | 用逗号分开的标签,如 bug,performance |
sort |
query | string | 否 | 排序依据:创建时间(created)、更新时间(updated_at);默认 created_at |
direction |
query | string | 否 | 排序方式:升序(asc)、降序(desc);默认 desc |
since |
query | string | 否 | 起始的更新时间,要求时间格式为 ISO 8601 |
page |
query | integer | 否 | 当前的页码 |
per_page |
query | integer | 否 | 每页的数量,最大为 100,默认 20 |
milestone |
query | string | 否 | 根据里程碑标题。none 为没有里程碑的,* 为所有带里程碑的 |
assignee |
query | string | 否 | 用户的 username。none 为没有指派者,* 为所有带有指派者的 |
creator |
query | string | 否 | 创建 Issues 的用户 username |
program |
query | string | 否 | 所属项目名称。none 为没有所属项目的,* 为所有带所属项目的 |
created_at |
query | string | 否 | 任务创建日期,格式 2024-11-09 |
created_before |
query | string | 否 | 任务创建截止时间,格式 2024-11-09 |
search |
query | string | 否 | 通过关键字搜索 Issue 标题或者内容 |
approximate |
query | boolean | 否 | 是否精确查询数量,默认 false |
响应参数¶
响应体为企业下所有 Issue 的数组。
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
id |
integer | 是 | 否 | Issue ID |
html_url |
string | 是 | 否 | Issue 的 HTML 地址 |
number |
string | 是 | 否 | Issue 编号 |
state |
string | 是 | 否 | Issue 状态 |
title |
string | 是 | 否 | Issue 标题 |
body |
string | 是 | 否 | Issue 内容 |
user |
object | 是 | 否 | Issue 创建者 |
repository |
object | 是 | 否 | Issue 所属仓库 |
created_at |
string | 是 | 否 | 创建时间 |
updated_at |
string | 是 | 否 | 更新时间 |
finished_at |
string | 是 | 是 | 完成时间 |
deadline |
string | 是 | 是 | 截止时间 |
labels |
object[] | 是 | 是 | 标签列表,可能为空数组 |
issue_state |
string | 是 | 否 | Issue 状态名称 |
comments |
integer | 是 | 否 | 评论数量 |
priority |
integer | 是 | 否 | 优先级 |
issue_type |
string | 是 | 否 | Issue 类型名称 |
issue_state_detail |
object | 是 | 否 | Issue 状态详情 |
issue_type_detail |
object | 是 | 否 | Issue 类型详情 |
issue_priority_detail |
object | 否 | 是 | Issue 优先级详情 |
parent_id |
integer | 是 | 否 | 父 Issue ID |
milestone |
object | 否 | 是 | 所属里程碑 |
url |
string | 是 | 否 | Issue 的 API 地址 |
repository_url |
string | 是 | 否 | 仓库的 API 地址 |
assignee |
object | 是 | 是 | 指派者 |
visibility_reason |
string | 否 | 是 | 可见性:public(公开可见)、confidential(私密,项目成员可见)、other(其他原因导致的仅项目成员可见) |
user 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
user.id |
string | 是 | 否 | 用户 ID |
user.login |
string | 是 | 否 | 用户名 |
user.name |
string | 是 | 否 | 用户昵称 |
repository 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
repository.id |
integer | 是 | 否 | 仓库 ID |
repository.full_name |
string | 是 | 否 | 仓库完整名称 |
repository.human_name |
string | 是 | 否 | 仓库显示名称 |
repository.path |
string | 是 | 否 | 仓库路径 |
repository.name |
string | 是 | 否 | 仓库名称 |
repository.url |
string | 是 | 否 | 仓库地址 |
repository.assigner |
object | 否 | 是 | 仓库分配者 |
repository.paas |
string | 是 | 是 | PaaS 标识 |
labels 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
labels.id |
integer | 是 | 否 | 标签 ID |
labels.name |
string | 是 | 否 | 标签名称 |
labels.color |
string | 是 | 否 | 标签颜色 |
labels.created_at |
string | 是 | 否 | 标签创建时间 |
labels.updated_at |
string | 是 | 否 | 标签添加时间 |
issue_state_detail 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
issue_state_detail.title |
string | 是 | 否 | 状态名称 |
issue_state_detail.serial |
integer | 是 | 否 | 状态序号 |
issue_state_detail.id |
integer | 是 | 否 | 状态 ID |
issue_type_detail 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
issue_type_detail.title |
string | 是 | 否 | 类型名称 |
issue_type_detail.id |
integer | 是 | 否 | 类型 ID |
issue_type_detail.is_system |
boolean | 是 | 否 | 是否为系统类型 |
issue_priority_detail 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
issue_priority_detail.id |
string | 是 | 否 | 优先级 ID |
issue_priority_detail.title |
string | 是 | 否 | 优先级名称 |
milestone 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
milestone.created_at |
string | 是 | 否 | 创建时间 |
milestone.description |
string | 是 | 否 | 里程碑描述 |
milestone.due_on |
string | 是 | 否 | 截止日期 |
milestone.html_url |
string | 是 | 否 | HTML 地址 |
milestone.number |
integer | 是 | 否 | 编号 |
milestone.repository_id |
integer | 是 | 否 | 仓库 ID |
milestone.state |
string | 是 | 否 | 状态 |
milestone.title |
string | 是 | 否 | 标题 |
milestone.updated_at |
string | 是 | 否 | 更新时间 |
milestone.url |
string | 是 | 否 | API 地址 |
assignee 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
assignee.avatar_url |
string | 是 | 否 | 头像地址 |
assignee.html_url |
string | 是 | 否 | 主页地址 |
assignee.id |
string | 是 | 否 | 用户 ID |
assignee.login |
string | 是 | 否 | 用户名 |
assignee.name |
string | 是 | 否 | 昵称 |
assignee.type |
string | 是 | 否 | 用户类型 |
失败响应¶
该接口可能返回以下失败响应(错误字段名以后端实际返回为准):
400 参数错误
401 未认证
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
400 |
参数错误(Bad request) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
404 |
请求路径不存在(Not found) |
429 |
请求过于频繁(Too many requests) |
500 |
系统内部错误(Internal server error) |
请求示例¶
参数说明¶
<enterprise>替换为企业的路径名(企业的路径 path/login); 此接口允许匿名访问,请求中可不携带访问令牌;如需携带,可追加?access_token=<token>。
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/enterprises/<enterprise>/issues?state=open&sort=created_at&direction=desc&page=1&per_page=20' \
-H 'Accept: application/json'
JavaScript¶
// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch(
"https://api.atomgit.com/api/v5/enterprises/<enterprise>/issues?state=open&sort=created_at&direction=desc&page=1&per_page=20",
{
headers: {
"Accept": "application/json",
},
}
);
if (!response.ok) {
throw new Error(`请求失败: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/enterprises/<enterprise>/issues",
params={
"state": "open",
"sort": "created_at",
"direction": "desc",
"page": 1,
"per_page": 20,
},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
响应示例¶
状态码: 200
[
{
"id": 340035,
"html_url": "https://api.atomgit.com/xiaogang_test/test222/issues/7",
"number": "7",
"state": "open",
"title": "2222",
"body": "2222",
"user": {
"id": "65f96506b3a9e65264980447",
"login": "xiaogang",
"name": "xiaogang"
},
"repository": {
"id": 249609,
"full_name": "xiaogang_test/test222",
"human_name": "测试组织 / test222",
"path": "test222",
"name": "test222",
"url": "https://api.atomgit.com/xiaogang_test/test222",
"assigner": {},
"paas": ""
},
"created_at": "2024-11-20T15:40:35+08:00",
"updated_at": "2024-11-20T15:40:35+08:00",
"finished_at": null,
"deadline": null,
"labels": [],
"issue_state": "未提单",
"priority": 0,
"issue_type": "需求",
"issue_state_detail": {
"title": "未提单",
"serial": 1,
"id": 222
},
"issue_type_detail": {
"title": "需求",
"id": 629,
"is_system": false
},
"issue_priority_detail": {
"id": "1",
"title": "普通"
},
"parent_id": 0,
"milestone": {
"created_at": "2024-11-20T15:40:35+08:00",
"description": "测试里程碑",
"due_on": "2024-12-31",
"html_url": "https://api.atomgit.com/xiaogang_test/test222/milestones/1",
"number": 1,
"repository_id": 249609,
"state": "open",
"title": "里程碑一",
"updated_at": "2024-11-20T15:40:35+08:00",
"url": "https://api.atomgit.com/api/v5/repos/xiaogang_test/test222/milestones/1"
},
"url": "https://api.atomgit.com/api/v5/repos/xiaogang_test/test222/issues/7",
"repository_url": "https://api.atomgit.com/api/v5/repos/xiaogang_test/test222",
"assignee": {
"avatar_url": "https://api.atomgit.com/avatar/xiaogang.png",
"html_url": "https://api.atomgit.com/xiaogang",
"id": "65f96506b3a9e65264980447",
"login": "xiaogang",
"name": "xiaogang",
"type": "User"
},
"visibility_reason": "public"
}
]
错误码¶
| 错误码 | 说明 |
|---|---|
400 |
参数错误或请求无法解析 |
401 |
未认证或凭证无效(缺少/无效的访问凭证) |
403 |
禁止访问 |
404 |
请求路径不存在 |
405 |
请求方法不支持 |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc