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

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.

GET Parameters

NameTypeDescription
revisionStringSpecifies 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

HTTP

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

JSON

{
  "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