创建一个提交,并能够变更多个文件。一般在日常开发中,一个提交通常会有多个文件变动,当前API就是应用于该情况。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
POST /api/v4/projects/repository/commits/files HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| organizationId |
string |
是 |
企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】 |
5ebbc0228123212b59xxxxx |
| accessToken |
string |
否 |
个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段 |
f0b1e61db5961df5975a93f9129d2513 |
| repositoryIdentity |
string |
是 |
代码库 ID 或者全路径 |
2835387 或 codeup/codeup-demo |
| body |
object |
否 |
请求 Body |
|
| branch |
string |
是 |
代码分支名称 |
master |
| commitMessage |
string |
否 |
提交说明信息 |
auto |
| actions |
array<object> |
是 |
操作数组,每个 action 代表一个文件的操作 |
|
|
object |
否 |
操作信息 |
||
| action |
string |
否 |
操作类型
|
create |
| filePath |
string |
否 |
文件路径 |
src/test.java |
| previousPath |
string |
否 |
变更前的文件路径 |
src/main/test.java |
| content |
string |
否 |
文件内容 重要 若是更新操作,则是完全覆盖,即传入的 content 内容,会直接覆盖原有的文件内容 |
Hello, Codeup! |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| requestId |
string |
请求 ID |
A7586FEB-E48D-5579-983F-74981FBFF627 |
| success |
boolean |
调用是否成功 |
true |
| errorCode |
string |
错误码 |
"" |
| errorMsg |
string |
错误信息 |
error |
| result |
object |
返回结果 说明
当前 API 返回的结果为提交信息 |
|
| id |
string |
提交 ID |
de02b625ba8488f92eb204bcb3773a40c1b4ddac |
| shortId |
string |
Commit 短 ID |
de02b625 |
| title |
string |
提交标题,提交的第一行内容 |
提交标题 |
| message |
string |
提交内容 |
具体的提交内容 |
| authorName |
string |
作者姓名 |
test-codeup |
| authorEmail |
string |
作者邮箱 |
username@example.com |
| authoredDate |
string |
作者提交时间,格式为 YYYY-MM-DD HH:mm:ss。 |
2022-03-18 15:00:00 |
| committerName |
string |
提交人的姓名 |
committer-codeup |
| committerEmail |
string |
提交人的邮箱 |
username@example.com |
| committedDate |
string |
提交人的提交时间,格式为 YYYY-MM-DD HH:mm:ss。 |
2022-03-18 16:00:00 |
| parentIds |
array |
父提交 ID 列表 |
|
|
string |
父提交 ID |
ff4fb5ac6d1f44f452654336d2dba468ae6c8d04 |
|
| createdAt |
string |
创建时间,格式为 YYYY-MM-DD HH:mm:ss。 |
2022-03-18 14:24:54 |
| author |
object |
作者信息 |
|
| id |
integer |
Codeup 的用户 ID |
19927 |
| aliyunPk |
string |
阿里云账号 ID |
1234567890 |
| name |
string |
用户名称 |
test-codeup |
| username |
string |
用户登录名 |
test-codeup |
|
string |
用户邮箱 |
username@example.com |
|
| state |
string |
用户状态,可选值:
|
active |
| avatarUrl |
string |
头像地址 |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c4ef67f1bea827c4/w/100/h/100 |
| websiteUrl |
string |
用户个人网页地址 |
"" |
| committer |
object |
提交者信息 |
|
| id |
integer |
Codeup 用户 ID |
24661 |
| aliyunPk |
string |
阿里云账号 ID |
1234567890 |
| name |
string |
用户名称 |
committer-codeup |
| username |
string |
用户登录名 |
committer-codeup |
|
string |
用户邮箱 |
username@example.com |
|
| state |
string |
用户状态,可选值:
|
active |
| avatarUrl |
string |
头像地址 |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
| websiteUrl |
string |
用户个人网页地址 |
"" |
示例
正常返回示例
JSON格式
{
"requestId": "A7586FEB-E48D-5579-983F-74981FBFF627",
"success": true,
"errorCode": "\"\"",
"errorMsg": "error",
"result": {
"id": "de02b625ba8488f92eb204bcb3773a40c1b4ddac",
"shortId": "de02b625",
"title": "提交标题",
"message": "具体的提交内容",
"authorName": "test-codeup",
"authorEmail": "username@example.com",
"authoredDate": "2022-03-18 15:00:00",
"committerName": "committer-codeup",
"committerEmail": "username@example.com",
"committedDate": "2022-03-18 16:00:00",
"parentIds": [
"ff4fb5ac6d1f44f452654336d2dba468ae6c8d04 "
],
"createdAt": "2022-03-18 14:24:54",
"author": {
"id": 19927,
"aliyunPk": "1234567890",
"name": "test-codeup",
"username": "test-codeup",
"email": "username@example.com",
"state": "active",
"avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c4ef67f1bea827c4/w/100/h/100",
"websiteUrl": "\"\""
},
"committer": {
"id": 24661,
"aliyunPk": "1234567890",
"name": "committer-codeup",
"username": "committer-codeup",
"email": "username@example.com",
"state": "active",
"avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
"websiteUrl": "\"\""
}
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。