GetProjectLabels - Get Project Labels List

Updated at:

Retrieve a list of project labels using OpenAPI.

Applicable editions

Central edition

Endpoints and Authorization Information

  • Obtain endpoints. Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId. This is only required for Central edition. Go to the Basic Information page in the Organization Management console to retrieve the organization ID.

Product

Resource

Required Permissions

Code Management

Project Labels

Read-only

Request Syntax

Central edition

GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/labels

Request Headers

Parameter

Type

Required

Description

Example Value

x-yunxiao-token

string

Yes

Personal access token.

pt-0fh3****0fbG_35af****0484

Request Parameters

Parameter

Type

Location

Required

Description

Example Value

organizationId

string

path

Yes

Organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

Repository ID or URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

search

string

query

No

Search by label name.

bug

page

integer

query

No

Page number.

1

with_counts

boolean

query

No

Include the count of associated open merge requests. Default is false.

true

per_page

integer

query

No

Items per page.

10

Request Example

curl -X 'GET' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/labels?search=bug&page=1&with_counts=true&per_page=10' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Return Parameters

Parameter

Type

Description

Example Value

-

array

-

object

color

string

Label color (hexadecimal format). Valid values: #006AD4, #2FA6A4, #6190AC, #4B81D0, #4D5DBB, #A16AD7, #3BA630, #95B44F, #AA945F, #B36A53, #FD842F, #EF433B.

#006AD4

description

string

Label description.

Indicates an error in the code

id

string

Label ID.

68c1bd9b8515477fa86fac5exxxxx941

name

string

Label name.

Bug

open_merge_requests_count

integer

Number of open merge requests associated with the label.

10

Return Example

[
    {
        "color": "#006AD4",
        "description": "Indicates an error in the code",
        "id": "68c1bd9b8515477fa86fac5exxxxx941",
        "name": "Bug",
        "open_merge_requests_count": 10
    }
]

Error Codes

For more information, see the error code center.