CreateLabel - Create label

Updated at:

Applicable editions

Central edition, Region edition

Service endpoint and authorization

Product

Resource

Required permission

project collaboration

label

Read/write

Request syntax

Central edition

POST https://{domain}/oapi/v1/projex/organizations/{organizationId}/projects/{id}/labels

Region edition

POST https://{domain}/oapi/v1/projex/projects/{id}/labels

Request header

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

The personal access token.

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

Request parameters

Parameter

Type

Location

Required

Description

Example

id

string

path

Yes

The unique ID of the project.

organizationId

string

path

  • Yes (Central edition)

  • No (Region edition)

The ID of the organization.

-

object

body

No

color

string

body

Yes

The color of the label. For example, #A773E0.

#A773E0

name

string

body

Yes

The name of the label.

test

operatorId

string

body

No

The ID of the user performing the operation. This parameter is ignored when a personal access token is used.

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/projex/organizations/{organizationId}/projects/{id}/labels' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "color": "#A773E0",
        "name": "test"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/projex/projects/{id}/labels' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "color": "#A773E0",
        "name": "test"
    }'

Response parameters

Parameter

Type

Description

Example

-

object

id

string

The ID of the created label.

id-xxx

Response example

{
    "id": "id-xxx"
}

Error codes

For a list of API-related error codes, see the Error Code Center.