CommitMultipleFiles - Commit Multiple File Changes
Commit multiple file changes using OpenAPI.
|
Applicable editions |
Central edition, Region edition |
Service Endpoints and Authorization Information
- Obtain the service endpoint. Replace {domain} in the API request syntax.
- Obtain a personal access token.
- Obtain the organization ID. Required only for Central edition. Navigate to the Basic Information page in the Organization Management console to retrieve the organization ID.
|
Product |
Resource |
Required Permissions |
|
Code Management |
File |
Request Syntax
Central edition
POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/multipleFiles
Region edition
POST https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/multipleFiles
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 |
|
Organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
Repository ID or URL-encoded full path. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
| - |
object |
body |
No |
|
|
| actions |
array |
body |
No |
|
|
| - |
object |
body |
No |
|
|
| action |
string |
body |
No |
Operation type
|
create |
| content |
string |
body |
No |
File content Note: For an update operation, the content completely overwrites the original file content.. |
xxx |
| file_path |
string |
body |
No |
File path. |
src/test.java |
| previous_path |
string |
body |
No |
File path before the change. |
src/main/test.java |
| branch |
string |
body |
No |
Branch name. |
demo-branch |
| commit_message |
string |
body |
No |
Commit message. Cannot be empty. Maximum 102,400 characters. |
create a file with content |
Request Examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/multipleFiles' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"actions": [
{
"action": "create",
"content": "xxx",
"file_path": "src/test.java",
"previous_path": "src/main/test.java"
}
],
"branch": "demo-branch",
"commit_message": "create a file with content"
}'
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/multipleFiles' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"actions": [
{
"action": "create",
"content": "xxx",
"file_path": "src/test.java",
"previous_path": "src/main/test.java"
}
],
"branch": "demo-branch",
"commit_message": "create a file with content"
}'
Response Parameters
|
Parameter |
Type |
Description |
Example Value |
| - |
object |
|
|
| authorEmail |
string |
Author's mailbox. |
username@example.com |
| authorName |
string |
Author's name. |
codeup-name |
| authoredDate |
string |
Author's commit time. |
2024-10-05T15:30:45Z |
| committedDate |
string |
Committer's commit time. |
2024-10-05T15:30:45Z |
| committerEmail |
string |
Committer's mailbox. |
username@example.com |
| committerName |
string |
Committer's name. |
codeup-name |
| id |
string |
Commit ID. |
6da8c14b5a9102998148b7ea35f96507d5304f74 |
| message |
string |
Commit content. |
commit message detail |
| parentIds |
array[string] |
Parent commit ID. |
["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"] |
| shortId |
string |
Code group path. |
6da8c14b |
| title |
string |
Title, the first line of the commit message. |
commit msg title |
| webUrl |
string |
Page access address. |
http://exmaple.com/example_repo/commit/commit_sha |
Response Example
{
"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": "6da8c14b5a9102998148b7ea35f96507d5304f74",
"message": "commit message detail",
"parentIds": ["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"],
"shortId": "6da8c14b",
"title": "commit msg title",
"webUrl": "http://exmaple.com/example_repo/commit/commit_sha"
}
Error Codes
For API error codes, see the Error Code Center.