Get all labels of a specific pull request¶
GET /api/v5/repos/{owner}/{repo}/pulls/{number}/labels
This endpoint retrieves all labels of a specific pull request in the specified repository. The pull request is located by namespace address, repository path, and pull request number, and the response is a list of labels containing each label's ID, name, color, and other information.
Supported access tokens¶
- 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 | Namespace address of the repository (the address path of an enterprise, organization, or user) |
repo |
path | string | Yes | Repository path (path) |
number |
path | integer | Yes | Ordinal number of the pull request in this repository |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
(response body) |
array | Yes | No | List of labels of this pull request; each array element is a label object |
label object (array element)
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Label ID |
color |
string | Yes | No | Label color, for example #ED4014 |
name |
string | Yes | No | Label name, for example bug |
repository_id |
integer | Yes | No | ID of the repository that the label belongs to |
url |
string | Yes | No | Label URL |
created_at |
string | Yes | No | Creation time (date, for example 2024-02-23) |
updated_at |
string | Yes | No | Update time (date, for example 2024-02-23) |
text_color |
string | Yes | No | Label text color, for example #FFFFFF |
Error response¶
This endpoint has no business error response.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
Request example¶
Parameter description¶
<owner>— Namespace address of the repository (the address path of an enterprise, organization, or user)<repo>— Repository path (path)<number>— Pull request number (the ordinal number of the pull request in this repository)
This endpoint allows anonymous access, so no access token is required. If you need authentication, you can append ?access_token=<token> to the URL to pass your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels",
{
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>/pulls/<number>/labels",
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc