Skip to content

Query Enterprise Labels with Pagination

GET /api/v8/enterprises/{enterprise_id}/label

Users call this API to query the list of labels under an enterprise with pagination.

Access Token Support

  • AtomGit user access tokens

Is Anonymous Access Allowed

This API allows anonymous access

Request Parameters

Parameter Name Location Type Required Description
enterprise_id path integer Yes Enterprise ID
order_by query string No Sort field, defaults to created
sort query string No Sort direction asc/desc, defaults to desc
include_expired query boolean No Whether to include expired items, defaults to true
label_ids query integer[] No List of label IDs
search query string No Search keyword, up to 100 characters
page query integer No Current page number, defaults to 1
per_page query integer No Number of items per page, defaults to 20

Response Parameters

Field Type Always Returned Nullable Description
id integer Yes Yes Label ID
name string Yes Yes Label name
color string Yes Yes Label color, e.g. #2865E0
description string No Yes Label description
repository_id integer No Yes Repository ID (not populated by this API, may be null)
url string No Yes Label URL (not populated by this API, may be null)
created_at string No Yes Creation time (not populated by this API, may be null)
updated_at string No Yes Update time (not populated by this API, may be null)

Note: The response body is an array of label objects; id, name, color, and description are the fields actually returned by this API. Although the remaining fields are declared in the response DTO, they are not populated by this API and are usually null (if the serialization configuration ignores null, they will not appear in the response).

Failure Responses

The API returns a failure response when parameters are invalid or authentication fails. The actual error field names are subject to what the backend returns.

400 Parameter Error

{
  "error": "invalid_request",
  "message": "参数不合法"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "缺少或无效的访问令牌"
}

HTTP Response Status Codes

Status Code Description
200 Success (OK)
400 Parameter error (Bad Request)
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Request path does not exist (Not Found)

Request Example

Parameter Description

The API allows anonymous access, so the request example may omit the access token; if needed, replace <token> with your AtomGit user access token. Replace <enterprise_id> with the enterprise ID

Replace <token> with your AtomGit user access token (optional).

cURL

curl -X GET 'https://api.atomgit.com/api/v8/enterprises/<enterprise_id>/label?page=1&per_page=20' \
  -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v8/enterprises/<enterprise_id>/label?page=1&per_page=20", {
  headers: {
    "Accept": "application/json",
  },
});

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v8/enterprises/<enterprise_id>/label",
    params={"page": 1, "per_page": 20},
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response Example

Status code: 200

[
  {
    "id": 382218,
    "name": "bug",
    "color": "#e03529",
    "description": "缺陷类问题标签"
  }
]

Error Codes

Error Code Description
400 Parameter error or request cannot be parsed
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
403 Forbidden
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