Modifying Repository File Contents
Function
This API is used to modify repository file contents.
The request header parameter X-Repo-Auth needs to be added for this API. Its value is the name of the OAuth authorization created in Creating OAuth Authorization.
URI
PUT /v1/{project_id}/git/files/{namespace}/{project}/{path}
Table 1 describes the parameters.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| project_id | String | Yes | Tenant's project ID. |
| namespace | String | Yes | Namespace ID or URL code name. |
| project | String | Yes | Repository project ID or URL code name. If the value contains a slash (/), replace it with a colon (:). |
| path | String | Yes | File path. If the value contains a slash (/), replace it with a colon (:). |
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| ref | String | Yes | Branch name, tag name, or commit SHA value. |
Request
Request parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| message | String | Yes | Description. |
| content | String | Yes | File contents. |
| sha | String | Yes | Commit SHA value. |
Response
Response parameters
| Parameter | Type | Description |
|---|---|---|
| path | String | File path. |
Example
Example request
{
"message": "string",
"content": "string",
"sha": "string"
} Example response
{
"path": "string"
} Status Code
| HTTP Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
Error code must be in the format of SVCSTG.REPO.[Error_ID]. Example: SVCSTG.REPO.0401. See ServiceStage Error Codes.
Last Article: Creating a Repository File
Next Article: Deleting a Repository File
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.