Skip to content

Replace all issue labels

PUT /api/v5/repos/{owner}/{repo}/issues/{number}/labels

This endpoint replaces all labels of the specified issue in the specified repository. The request body is an array of strings made up of label names; after replacement, the issue's labels are determined entirely by the passed array.

Access token support

  • AtomGit user access tokens

Anonymous access allowed

Anonymous access is not allowed for this endpoint.

Request parameters

Parameter Location Type Required Description
owner path string Yes The namespace address the repository belongs to (the address path of an enterprise, organization, or individual)
repo path string Yes Repository path
number path string Yes Issue number (case-sensitive, no need to add a #)
access_token query string Yes User authorization code

Request Body:

The request body is an array of strings made up of label names; after replacement, the issue's labels are determined entirely by the passed array.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "array",
  "items": {
    "description": "Label name",
    "type": "string"
  }
}

Response parameters

The response body is an empty object ({}), indicating a successful replacement with no business fields returned.

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication
404 Not found

Request example

Parameter notes

Replace <owner> with the namespace address the repository belongs to (the address path of an enterprise, organization, or individual); replace <repo> with the repository path; replace <number> with the issue number (case-sensitive, no need to add a #); replace <token> with your AtomGit user access token; replace <labels> with the array of label names.

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/issues/<number>/labels?access_token=<token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '["bug","help wanted"]'

JavaScript

const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/issues/<number>/labels?access_token=<token>", {
  method: "PUT",
  headers: {
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify(["bug", "help wanted"]),
});

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>/issues/<number>/labels?access_token=<token>",
    json=["bug", "help wanted"],
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Invalid parameters or the request cannot be parsed
404 Request path does not exist
405 Request method 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