DeleteBranch - Delete branch
Delete a specified branch from a code repository.
|
Applicable editions |
Central edition, Region edition |
Endpoint and authorization information
-
Get the endpoint: Replace {domain} in the request syntax with the endpoint.
-
Obtain the organization ID: Required for the Central edition only. Go to the Basic Information page in the Organization Management console to obtain your organization ID.
|
Product |
Resource |
Required permission |
|
Code Management |
Branch |
Read and write |
Request syntax
Central edition
DELETE https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/branches/{branchName}
Region edition
DELETE https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/branches/{branchName}
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 |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID or URL-encoded full path. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
branchName |
string |
path |
Yes |
The branch name. URL-encode the value if it contains special characters. |
demo-branch or feature%2Fdemo-branch |
Request examples
Central edition
curl -X 'DELETE' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489%E6%88%96%E8%80%8560de7a6852743a5162b5f957%2FDemoRepo/branches/demo-branch%E6%88%96%E8%80%85feature%2Fdemo-branch' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Region edition
curl -X 'DELETE' \
'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/branches/demo-branch or feature%2Fdemo-branch' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
object |
||
|
branchName |
string |
The name of the deleted branch. |
Response example
{
"branchName": ""
}
Error codes
For a list of error codes, see Error Code Center.