CreateTag - Create a tag
Creates a tag in a code repository.
|
Applicable editions |
Central edition, Region edition |
Endpoints and authorization information
-
Obtain an endpoint. Replace {domain} in the API request syntax.
-
Obtain the organization ID. This is required only for the Central edition. Go to the Basic Information page in the Organization Management console.
|
Product |
Resource |
Required permission |
|
Code Management |
Tag |
Read/Write |
Request syntax
Central edition
POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/tags
Region edition
POST https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/tags
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
Your personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Position |
Required |
Description |
Example |
|
organizationId |
string |
path |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID or the URL-encoded full path of the repository. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
tagName |
string |
query |
Yes |
The tag name. URL-encode the name if it contains special characters. |
v1.0 |
|
ref |
string |
query |
Yes |
The source reference: a branch name, tag name, or commit SHA. |
master |
|
message |
string |
query |
No |
The tag description. |
Tag description |
Request examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/tags?tagName=v1.0&ref=master&message=Tag description' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/tags?tagName=v1.0&ref=master&message=Tag description' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
object |
||
| commit |
object |
Commit information. |
|
|
authorEmail |
string |
The email address of the author. |
username@example.com |
|
authorName |
string |
The name of the author. |
codeup-name |
|
authoredDate |
string |
The time when the commit was authored. |
2024-10-05T15:30:45Z |
|
committedDate |
string |
The commit timestamp. |
2024-10-05T15:30:45Z |
|
committerEmail |
string |
The email address of the committer. |
username@example.com |
|
committerName |
string |
The name of the committer. |
codeup-name |
|
id |
string |
The commit ID. |
de02b625ba8488f92eb204bcb3773a40c1b4ddac |
|
message |
string |
The commit message. |
Commit Message |
|
parentIds |
array[string] |
The parent commit IDs. |
["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"] |
|
shortId |
string |
The abbreviated commit ID. |
de02b625 |
| stats |
object |
Information about line changes. |
|
|
additions |
integer |
The number of added lines. |
1 |
|
deletions |
integer |
The number of deleted lines. |
1 |
|
total |
integer |
The total number of changed lines. |
2 |
|
title |
string |
The title, which is the first line of the commit message. |
Commit Title |
|
webUrl |
string |
The web URL of the commit. |
http://exmaple.com/example_repo/commit/commit_sha |
|
id |
string |
The primary key ID. |
de02b625ba8488f92eb204bcb3773a40c1b4ddac |
|
message |
string |
The description of the tag. |
Description content |
|
name |
string |
The name of the tag. |
v1.0 |
| release |
object |
Release information. |
|
|
description |
string |
The description. |
Description content |
|
tagName |
string |
The name of the tag. |
v1.0 |
Response example
{
"commit": {
"authorEmail": "username@example.com",
"authorName": "codeup-name",
"authoredDate": "2024-10-05T15:30:45Z",
"committedDate": "2024-10-05T15:30:45Z",
"committerEmail": "username@example.com",
"committerName": "codeup-name",
"id": "de02b625ba8488f92eb204bcb3773a40c1b4ddac",
"message": "Commit Message",
"parentIds": ["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"],
"shortId": "de02b625",
"stats": {
"additions": 1,
"deletions": 1,
"total": 2
},
"title": "Commit Title",
"webUrl": "http://exmaple.com/example_repo/commit/commit_sha"
},
"id": "de02b625ba8488f92eb204bcb3773a40c1b4ddac",
"message": "Description content",
"name": "v1.0",
"release": {
"description": "Description content",
"tagName": "v1.0"
}
}
Error codes
For more information about API error codes, see the Error Code Center.