CreateProjectLabel - Create Project Label
Creates project labels using OpenAPI.
|
Applicable editions |
Central edition |
Service Endpoints and Authorization Information
- Obtain service endpoints: Use the endpoint to replace {domain} in the API request syntax.
- Obtain a personal access token.
- Obtain the organization ID: This is required only for the Central edition. Go to the Basic Information page in the Organization Management console to obtain the ID.
|
Product |
Resource |
Required Permissions |
|
Code Management |
Project Label |
Read/Write |
Request Syntax
Central edition
POST 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 |
| - |
object |
body |
No |
|
|
| label_color |
string |
body |
Yes |
Label color in hexadecimal format. Valid values are: #006AD4, #2FA6A4, #6190AC, #4B81D0, #4D5DBB, #A16AD7, #3BA630, #95B44F, #AA945F, #B36A53, #FD842F, #EF433B. |
#006AD4 |
| label_description |
string |
body |
No |
Label description. |
Indicates an error in the code |
| label_name |
string |
body |
Yes |
Label name. |
Bug |
Request Example
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/labels' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"label_color": "#006AD4",
"label_description": "Indicates an error in the code",
"label_name": "Bug"
}'
Response Parameters
|
Parameter |
Type |
Description |
Example Value |
| - |
object |
|
|
| color |
string |
Label color in hexadecimal format. Valid values are: #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 |
Response Example
{
"color": "#006AD4",
"description": "Indicates an error in the code",
"id": "68c1bd9b8515477fa86fac5exxxxx941",
"name": "Bug"
}
Error Codes
For more information about API error codes, see Error Code Center.