DeleteFile - Delete a file
Deletes a specified file from a code repository.
|
Applicable editions |
Central edition, Region 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. Go to the Basic Information page in the Organization Management console to obtain the organization ID.
|
Product |
Resource |
Required permission |
|
Code Management |
File |
Read and write |
Request syntax
Central edition
DELETE https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/files/{rest:.*}
Region edition
DELETE https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/files/{rest:.*}
Request headers
|
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 |
|
organizationId |
string |
path |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID or URL-encoded full path. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
filePath |
string |
path |
Yes |
The file path, which must be URL-encoded. |
test.txt or src%2Fmain.java |
|
branch |
string |
query |
Yes |
The branch name. |
master |
|
commitMessage |
string |
query |
Yes |
The commit message. |
delete a file |
Request examples
Central edition
curl -X 'DELETE' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/files/{rest:.*}?branch=master&commitMessage=delete a file' \
-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/files/{rest:.*}?branch=master&commitMessage=delete a file' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
object |
|
|
| result |
boolean |
Indicates whether the file was deleted successfully. |
true |
Response example
{
"result": true
}
Error codes
For API error codes, see Error Code Center.