获取企业里程碑列表¶
GET /api/v8/enterprises/{enterprise}/milestones
用户调用此接口,获取企业里程碑列表。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口不允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
enterprise |
path | string | 是 | 企业id |
access_token |
query | string | 是 | 用户授权码 |
name |
query | string | 否 | 名称 |
state |
query | string | 否 | 状态 |
order_by |
query | string | 否 | 排序字段。可选:updated_at |
sort |
query | string | 否 | 排序方式。降序:desc;升序:asc |
page |
query | string | 否 | 当前的页码,默认 1 |
per_page |
query | string | 否 | 每页的数量,最大 100,默认 20 |
响应参数¶
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
id |
integer | 是 | — | id |
title |
string | 是 | — | 标题 |
description |
string | 是 | — | 描述 |
state |
string | 是 | — | 状态 |
created_at |
string | 是 | — | 创建时间 |
updated_at |
string | 是 | — | 更新时间 |
due_date |
string | 否 | — | 截止时间 |
start_date |
string | 否 | — | 开始时间 |
projects |
object[] | 是 | — | 项目列表 |
projects 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
projects.id |
integer | 是 | — | 项目id |
projects.description |
string | 是 | — | 项目描述 |
projects.name |
string | 是 | — | 项目名称 |
projects.name_with_namespace |
string | 是 | — | 含命名空间的名称 |
projects.path |
string | 是 | — | 项目路径 |
projects.path_with_namespace |
string | 是 | — | 含命名空间的路径 |
projects.created_at |
string | 是 | — | 创建时间 |
projects.updated_at |
string | 是 | — | 更新时间 |
projects.archived |
boolean | 是 | — | 是否归档 |
失败响应¶
该接口可能返回以下失败响应,示例字段名以后端实际返回为准。
400 参数错误
401 未认证
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
请求示例¶
参数说明¶
<enterprise>替换为企业id;<token>替换为你的 AtomGit 用户访问令牌。
cURL¶
curl -X GET 'https://api.atomgit.com/api/v8/enterprises/<enterprise>/milestones?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
const response = await fetch(
"https://api.atomgit.com/api/v8/enterprises/<enterprise>/milestones?access_token=<token>",
{
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/v8/enterprises/<enterprise>/milestones",
params={"access_token": "<token>"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
响应示例¶
状态码: 200
[
{
"id": 1,
"title": "V1.0 里程碑",
"description": "V1.0 版本发布计划",
"state": "open",
"created_at": "2026-01-01T00:00:00+08:00",
"updated_at": "2026-02-01T00:00:00+08:00",
"due_date": "2026-03-01",
"start_date": "2026-01-15",
"projects": [
{
"id": 100,
"description": "企业 API 仓库",
"name": "gitcode-open-api",
"name_with_namespace": "my-enterprise/gitcode-open-api",
"path": "gitcode-open-api",
"path_with_namespace": "my-enterprise/gitcode-open-api",
"created_at": "2025-12-01T00:00:00+08:00",
"updated_at": "2026-02-01T00:00:00+08:00",
"archived": false
}
]
}
]
错误码¶
| 错误码 | 说明 |
|---|---|
401 |
未认证或凭证无效(缺少/无效的访问凭证) |
400 |
参数错误或请求无法解析 |
404 |
请求路径不存在 |
405 |
请求方法不支持 |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc