Skip to content

Get a single repository milestone

GET /api/v5/repos/{owner}/{repo}/milestones/{number}

This endpoint retrieves detailed information about a single milestone in the specified repository, including the milestone title, description, state, due date, creation and update times, and the associated closed and open issue counts.

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)
number path integer Yes Milestone serial number (number)

Response parameters

Field Type Always returned Nullable Description
closed_issues integer Yes — Number of closed issues
created_at string Yes — Milestone creation time
description string Yes — Milestone description
due_on string Yes — Milestone due date
number integer Yes — Milestone serial number (number)
open_issues integer Yes — Number of open issues
repository_id integer Yes — ID of the owning repository
state string Yes — Milestone state (for example, active)
title string Yes — Milestone title
updated_at string Yes — Milestone update time
url string Yes — Milestone address

Error response

When the request fails, the endpoint returns a non-200 status code along with a response body that describes the error. The error response body field names are subject to the actual backend response.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Invalid parameters or the request cannot be parsed"
}

404 Resource not found

{
  "error": "not_found",
  "message": "Milestone does not exist"
}

HTTP response status codes

Status code Description
200 Success (OK)
304 Not modified
401 Requires authentication
403 Forbidden
404 Resource not found

Request example

Parameter description

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); replace <number> with the milestone serial number (number).

Note: This endpoint allows anonymous access, so the examples do not need to carry a token; to access a private repository, you can add an AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/milestones/<number>' \
  -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/<number>", {
  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/<number>",
    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 or the milestone 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