Get all repository milestones¶
GET /api/v5/repos/{owner}/{repo}/milestones
This endpoint retrieves all milestones in the specified repository. It supports filtering by state (open, closed, or all), sorting by due date, and paginated viewing, returning information such as the milestone title, state, due date, and number of associated issues.
Access token support¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Address of the namespace that owns the repository (the address path of an enterprise, organization, or personal namespace) |
repo |
path | string | Yes | Repository path (path) |
state |
query | string | No | Milestone state. Enum: open / closed / all; default open |
sort |
query | string | No | Sort method. Enum: due_on |
direction |
query | string | No | Sort direction. Enum: asc / desc; default asc |
page |
query | integer | No | Current page number |
per_page |
query | integer | No | Number of items per page, maximum 100, default 20 |
Response parameters¶
milestone object (the response is an array whose elements are milestone objects)
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
closed_issues |
integer | Yes | — | Number of closed issues |
created_at |
string | Yes | — | Creation time |
description |
string | Yes | — | Milestone description |
due_on |
string | Yes | — | Due date |
number |
integer | Yes | — | Milestone number |
open_issues |
integer | Yes | — | Number of open issues |
repository_id |
integer | Yes | — | ID of the owning repository |
state |
string | Yes | — | Milestone state |
title |
string | Yes | — | Milestone title |
updated_at |
string | Yes | — | Update time |
url |
string | Yes | — | URL of the milestone |
Error response¶
400 Invalid parameters
401 Unauthenticated
Note: The error field names and messages are subject to the actual backend response.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Requires authentication |
403 |
Forbidden |
Request example¶
Parameter description¶
All examples call the endpoint anonymously; to include a token, add the access_token query parameter to the request.
Replace
<owner>with the address of the namespace that owns the repository (the address path of an enterprise, organization, or personal namespace); replace<repo>with the repository path (path).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/milestones?state=open&direction=asc&page=1&per_page=20' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/milestones?state=open&direction=asc&page=1&per_page=20", {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${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>/milestones",
params={"state": "open", "direction": "asc", "page": 1, "per_page": 20},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"closed_issues": 0,
"created_at": "2024-10-08T10:58:16+08:00",
"description": "Hello China",
"due_on": "2024-11-08",
"number": 4914,
"open_issues": 0,
"repository_id": 4066481,
"state": "active",
"title": "Hello China",
"updated_at": "2024-10-08T10:58:16+08:00",
"url": "https://api.atomgit.com/dengmengmian/oneapi/milestones/1"
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access token) |
400 |
Invalid parameters or the request cannot be parsed |
404 |
The request path does not exist |
405 |
The request method is not supported |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc