AttachLabelsToChangeRequest - Associate Labels with a Merge Request

Updated at:

Associate labels with a merge request using OpenAPI.

Applicable editions

Central edition

Endpoints and Authorization Information

  • Obtain an endpoint: Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId: Required only for the Central edition . You can go to the Basic Information page in the Tenant Management console to obtain the organization ID.

Product

Resource

Required Permissions

Code Management

Merge Request

Read/Write

Request Syntax

Central edition

POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/changeRequests/{localId}/labels

Request Headers

Parameter

Type

Required

Description

Example Value

x-yunxiao-token

string

Yes

The personal access token.

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

Request Parameters

Parameter

Type

Location

Required

Description

Example Value

organizationId

string

path

Yes

The organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

The repository ID or the URL-encoded full path.

2813489or60de7a6852743a5162b5f957%2FDemoRepo

localId

integer

path

Yes

The local ID, which indicates the sequence number of the merge request in the repository.

42

-

object

body

No

label_id_list

array[string]

body

Yes

The list of label IDs to associate.

["68c1bd9b8515477fa86fac5exxxxx942", "68c1bd9b8515477fa86fac5exxxxx941"]

Request Example

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/changeRequests/42/labels' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "label_id_list": ["68c1bd9b8515477fa86fac5exxxxx942", "68c1bd9b8515477fa86fac5exxxxx941"]
    }'

Response Parameters

Parameter

Type

Description

Example Value

-

object

result

boolean

Indicates whether the operation was successful.

true

Response Example

{
    "result": true
}

Error Codes

For more information, see the Error Code Center.