获取仓库的所有Releases¶
GET /api/v5/repos/{owner}/{repo}/releases
获取指定仓库的所有 Releases(发布版本)列表。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
owner |
path | string | 是 | 仓库所属空间地址(企业、组织或个人的地址path) |
repo |
path | string | 是 | 仓库路径(path) |
access_token |
query | string | 否 | 用户授权码 |
direction |
query | string | 否 | 升序/降序,不填为升序 |
page |
query | integer | 否 | 当前的页码 |
per_page |
query | integer | 否 | 每页的数量,最大为100,默认20 |
响应参数¶
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
tag_name |
string | 是 | 否 | 标签名称 |
target_commitish |
string | 是 | 否 | 目标提交(commit)SHA值 |
prerelease |
boolean | 是 | 否 | 是否为预发布 |
name |
string | 是 | 否 | 发布名称 |
body |
string | 是 | 否 | 发布说明 |
author |
object | 是 | 否 | 发布作者信息 |
created_at |
string | 是 | 否 | 创建时间 |
assets |
object[] | 是 | 否 | 发布附件列表 |
release_status |
string | 是 | 否 | 发布状态 |
author 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
author.id |
string | 是 | 否 | 用户ID |
author.login |
string | 是 | 否 | 用户名 |
author.name |
string | 是 | 否 | 用户昵称 |
author.avatar_url |
string | 是 | 否 | 用户头像地址 |
author.html_url |
string | 是 | 否 | 用户主页地址 |
author.type |
string | 是 | 否 | 用户类型 |
author.url |
string | 是 | 否 | 用户 API 地址 |
assets 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
assets.browser_download_url |
string | 是 | 否 | 浏览器下载地址 |
assets.name |
string | 是 | 否 | 附件名称 |
assets.type |
string | 是 | 否 | 附件类型 |
assets.id |
number | 否 | 是 | 附件ID |
失败响应¶
400 参数错误
401 未认证
404 资源不存在
错误字段名以后端实际返回为准。
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
304 |
未修改(Not modified) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
404 |
资源不存在(Not found) |
请求示例¶
参数说明¶
<owner>替换为仓库所属空间地址(企业、组织或个人的地址 path);<repo>替换为仓库路径(path)。
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases?page=1&per_page=20' \
-H 'Accept: application/json'
此接口允许匿名访问;如需访问私有仓库,可携带访问令牌:
?access_token=<token>。
JavaScript¶
// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases?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/repos/<owner>/<repo>/releases",
params={"page": 1, "per_page": 20},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
响应示例¶
状态码: 200
[
{
"tag_name": "v1.0.217",
"target_commitish": "930401b0dd58a809fce34da091b8aa3d6083cb33",
"prerelease": false,
"name": "release1 名称",
"body": "release1 描述",
"author": {
"id": "26593",
"login": "fenglonghui",
"name": "龙辉",
"avatar_url": "https://api.atomgit.com/avatar.png",
"html_url": "https://api.atomgit.com/fenglonghui",
"type": "User",
"url": "https://api.atomgit.com/api/v5/users/fenglonghui"
},
"created_at": "2025-01-16T19:58:07+08:00",
"assets": [
{
"browser_download_url": "https://api.atomgit.com/rust-learning/serde/-/archive/v1.0.217/serde-v1.0.217.zip",
"name": "serde-v1.0.217.zip",
"type": "zip",
"id": 1
}
],
"release_status": "published"
}
]
错误码¶
| 错误码 | 说明 |
|---|---|
401 |
未认证或凭证无效(缺少/无效的访问凭证) |
400 |
参数错误或请求无法解析 |
404 |
请求路径不存在 |
405 |
请求方法不支持 |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc