Replace all labels on a pull request¶
PUT /api/v5/repos/{owner}/{repo}/pulls/{number}/labels
This endpoint replaces all labels of a specific pull request. The request body is an array of label names; once submitted, it overwrites every existing label on the pull request, and a successful response returns an empty object.
Supported access tokens¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Namespace address of the repository (the address path of an organization or user) |
repo |
path | string | Yes | Repository path (path) |
number |
path | integer | Yes | Ordinal number of the pull request in this repository |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is an array of label names that replaces all labels of the pull request.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"type": "string",
"description": "Label name"
}
}
Response parameters¶
On success the response body is an empty object {} with no business fields.
Error response¶
The following are example error responses that this endpoint may return.
400 Invalid parameters
401 Unauthenticated
404 Resource not found
Error field names are as actually returned by the backend.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Bad request |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Not found |
Request example¶
Parameter description¶
Replace
<owner>with the namespace address of the repository (the address path of an organization or user); replace<repo>with the repository path; replace<number>with the pull request number; replace<token>with your AtomGit user access token.
cURL¶
curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '["bug", "enhancement"]'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels?access_token=<token>",
{
method: "PUT",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify(["bug", "enhancement"])
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.put(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels",
params={"access_token": "<token>"},
headers={
"Accept": "application/json",
"Content-Type": "application/json"
},
json=["bug", "enhancement"],
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
Error codes¶
| Error code | Description |
|---|---|
400 |
Invalid parameters or the request cannot be parsed |
401 |
Unauthenticated or invalid credentials |
403 |
No permission to perform this operation |
404 |
The requested pull request or label does not exist |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc