Update a file

Updates a file in the repository

Required scopes: WORKSPACE, REPOSITORY_WRITE

Resource URL

PUT /workspaces/:domain/projects/:project_name/repository/contents/:path

URL Parameters

NameTypeDescription
domain
Required
StringThe workspace domain.
path
Required
StringThe file or directory location in the repository.
project_name
Required
StringThe name ID of the project.

POST Parameters

NameTypeDescription
content
Required
StringThe file contents encoded in Base64.
message
Required
StringThe log message of the commit.
branchStringThe target branch for the commit operation.

Example

Request

PUT https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/htaccess

JSON

{
"branch": "development",
"message": "edit htacces",
"content": "PElmTW9kdWxlIG1vZF9yZXdyaXRlLmM+DQpSZXdyaXRlRW5naW5lIE9uDQpSZXdyaXRlQmFzZSAvDQpSZXdyaXRlQ29uZCAle1JFUVVFU1RfRklMRU5BTUV9ICEtZg0KUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWQNClJld3JpdGVSdWxlICguKikgaW5kZXgucGhwIFtMXQ0KPC9JZk1vZHVsZT4NCg=="
}

Sample Response

HTTP

Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
"content": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/htaccess?revision=df3090c47fcea8d3a420e0059490f3824227a1ce",
"html_url": "https://app.buddy.works/buddy/company-website/repository/content/revision/df3090c47fcea8d3a420e0059490f3824227a1ce/htaccess",
"content_type": "FILE",
"encoding": "base64",
"size": 178,
"name": "htaccess",
"path": "htaccess",
"content": "PElmTW9kdWxlIG1vZF9yZXdyaXRlLmM+DQpSZXdyaXRlRW5naW5lIE9uDQpSZXdyaXRlQmFzZSAvDQpSZXdyaXRlQ29uZCAle1JFUVVFU1RfRklMRU5BTUV9ICEtZg0KUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWQNClJld3JpdGVSdWxlICguKikgaW5kZXgucGhwIFtMXQ0KPC9JZk1vZHVsZT4NCg=="
},
"commit": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/df3090c47fcea8d3a420e0059490f3824227a1ce",
"html_url": "https://app.buddy.works/buddy/company-website/repository/commit/df3090c47fcea8d3a420e0059490f3824227a1ce",
"revision": "df3090c47fcea8d3a420e0059490f3824227a1ce",
"author_date": "2016-03-02T12:37:44Z",
"commit_date": "2016-03-02T12:37:44Z",
"message": "edit htacces",
"committer": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png",
"title": "Creative director"
},
"author": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png",
"title": "Creative director"
}
}
}