Directories & files

Get contents

Returns the contents of the repository for the specified revision or HEAD.
Required scopes: WORKSPACE, REPOSITORY_READ

Resource URL

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

URL Parameters

Name Description
domain Required String The workspace domain.
path Required String The file or directory location in the repository.
project_name Required String The name ID of the project.

GET Parameters

Name Description
revision String Specifies the revision to return the contents of the commit.

Example

Request
GET
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents?revision=development
Sample Response
Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
{
  "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/?revision=development",
  "html_url": "https://app.buddy.works/buddy/company-website/repository/content/branch/development",
  "contents": [
    {
      "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/scss?revision=development",
      "html_url": "https://app.buddy.works/buddy/company-website/repository/content/branch/development/%2Fscss",
      "content_type": "DIR",
      "name": "scss",
      "path": "/scss"
    },
    {
      "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/.gitignore?revision=development",
      "html_url": "https://app.buddy.works/buddy/company-website/repository/content/branch/development/.gitignore",
      "content_type": "FILE",
      "encoding": "base64",
      "size": 22,
      "name": ".gitignore",
      "path": ".gitignore",
      "content": "LmlkZWEvCi5EU19TdG9yZQpjc3MvCg=="
    },
    {
      "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/public?revision=development",
      "html_url": "https://app.buddy.works/buddy/company-website/repository/content/branch/development/%2Fpublic",
      "content_type": "SUB_MODULE",
      "name": "public",
      "path": "/public"
    }
  ]
}

content_type can be either FILE, DIR, SYMLINK, or SUB_MODULE. encoding always set to base64

Create a file

Creates a new file in the repository
Required scopes: WORKSPACE, REPOSITORY_WRITE

Resource URL

POST
/workspaces/:domain/projects/:project_name/repository/contents

URL Parameters

Name Description
domain Required String The workspace domain.
project_name Required String The name ID of the project.

POST Parameters

Name Description
content Required String The file contents encoded in Base64.
message Required String The log message of a commit.
path Required String The new file location in the repository.
branch String The branch name.

Example

Request
POST
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents
{
  "path": "test.txt",
  "branch": "development",
  "message": "add test.txt",
  "content": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTnVuYyBwcmV0aXVtIG9kaW8gZWdldCB0ZWxsdXMgYWxpcXVhbSwgdmVsIHZ1bHB1dGF0ZSBzYXBpZW4gdmVzdGlidWx1bS4="
}
Sample Response
Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
{
  "content": {
    "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/test.txt?revision=f659e787d8f6c19c125c60c025afa9d0def29fed",
    "html_url": "https://app.buddy.works/buddy/company-website/repository/content/revision/f659e787d8f6c19c125c60c025afa9d0def29fed/test.txt",
    "content_type": "FILE",
    "encoding": "base64",
    "size": 128,
    "name": "test.txt",
    "path": "test.txt",
    "content": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTnVuYyBwcmV0aXVtIG9kaW8gZWdldCB0ZWxsdXMgYWxpcXVhbSwgdmVsIHZ1bHB1dGF0ZSBzYXBpZW4gdmVzdGlidWx1bS4="
  },
  "commit": {
    "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/f659e787d8f6c19c125c60c025afa9d0def29fed",
    "html_url": "https://app.buddy.works/buddy/company-website/repository/commit/f659e787d8f6c19c125c60c025afa9d0def29fed",
    "revision": "f659e787d8f6c19c125c60c025afa9d0def29fed",
    "author_date": "2016-03-02T12:31:32Z",
    "commit_date": "2016-03-02T12:31:32Z",
    "message": "add test.txt",
    "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"
    }
  }
}

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

Name Description
domain Required String The workspace domain.
path Required String The file or directory location in the repository.
project_name Required String The name ID of the project.

POST Parameters

Name Description
content Required String The file contents encoded in Base64.
message Required String The log message of the commit.
branch String The target branch for the commit operation.

Example

Request
PUT
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/htaccess
{
  "branch": "development",
  "message": "edit htacces",
  "content": "PElmTW9kdWxlIG1vZF9yZXdyaXRlLmM+DQpSZXdyaXRlRW5naW5lIE9uDQpSZXdyaXRlQmFzZSAvDQpSZXdyaXRlQ29uZCAle1JFUVVFU1RfRklMRU5BTUV9ICEtZg0KUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWQNClJld3JpdGVSdWxlICguKikgaW5kZXgucGhwIFtMXQ0KPC9JZk1vZHVsZT4NCg=="
}
Sample Response
Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
{
  "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"
    }
  }
}

Delete a file

Removes a file from the repository
Required scopes: WORKSPACE, REPOSITORY_WRITE

Resource URL

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

URL Parameters

Name Description
domain Required String The workspace domain.
path Required String The file or directory location in the repository.
project_name Required String The name ID of the project.

POST Parameters

Name Description
message Required String The log message of the commit.
branch String The target branch for the commit operation.

Example

Request
DELETE
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/contents/test.txt
{
  "branch": "development",
  "message": "delete test.txt"
}
Sample Response
Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
{
  "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/a276b914f11f7dfeb88e46375b0b1e51b8c1578c",
  "html_url": "https://app.buddy.works/buddy/company-website/repository/commit/a276b914f11f7dfeb88e46375b0b1e51b8c1578c",
  "revision": "a276b914f11f7dfeb88e46375b0b1e51b8c1578c",
  "author_date": "2016-03-02T12:31:51Z",
  "commit_date": "2016-03-02T12:31:51Z",
  "message": "delete test.txt",
  "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"
  }
}
esc

Sign up for free

No setup fees. No requirements. No obligation.

or sign up with