UpdateFile - 修改文件

更新时间:
复制 MD 格式

修改代码库某个文件。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

PUT /repository/{repositoryId}/files/update HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

repositoryId

string

是

代码库 ID

2813489

请求参数

名称

类型

必填

描述

示例值

organizationId

string

是

企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】

60de7a6852743a5162b5f957

accessToken

string

否

个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段

0cf2c8458ac44d9481aab2dd6ec10596v3

body

object

否

请求 Body

oldPath

string

是

旧文件路径

src/main/update.txt

newPath

string

是

新文件路径

src/main/update.txt

branchName

string

是

分支名称

master

encoding

string

否

编码方式 可选:text / base64,默认值为 text

text

content

string

是

文件内容

修改文件的内容

commitMessage

string

是

更新文件时的提交信息

修改update.txt文件内容

返回参数

名称

类型

描述

示例值

object

Schema of Response

requestId

string

请求 ID

C2F153F6-BB43-50C4-9F4F-40593203E19A

errorMessage

string

错误信息

""

errorCode

string

错误码

SYSTEM_UNKNOWN_ERROR

success

boolean

调用是否成功

true

result

object

返回结果

branchName

string

分支名称

master

filePath

string

文件路径

src/main/update.txt

示例

正常返回示例

JSON格式

{
  "requestId": "C2F153F6-BB43-50C4-9F4F-40593203E19A",
  "errorMessage": "\"\"",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "success": true,
  "result": {
    "branchName": "master",
    "filePath": "src/main/update.txt"
  }
}

错误码

HTTP status code

错误码

错误信息

描述

403 Forbidden.UserNotAdminOrOwner The current user is not an admin or owner in the organization and is not authorized to perform the operation. 当前用户非该企业管理员或拥有者,无权进行操作。
403 Forbidden.UserNotInCurrentOrganization The user is not in the organization and is not authorized to perform the operation. 当前用户不在该企业中,无权进行操作。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。