Branches

List branches

Returns branches from the project repository.
Required scopes: WORKSPACE, REPOSITORY_READ

Resource URL

GET
/workspaces/:domain/projects/:project_name/repository/branches

URL Parameters

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

Example

Request
GET
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches
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/branches",
  "html_url": "https://app.buddy.works/buddy/company-website/repository/branches",
  "branches": [
    {
      "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches/master",
      "html_url": "https://app.buddy.works/buddy/company-website/repository/branch/master",
      "name": "master",
      "default": true
    }
  ]
}

Get the revision

Returns the revision info.
Required scopes: WORKSPACE, REPOSITORY_READ

Resource URL

GET
/workspaces/:domain/projects/:project_name/repository/branches/:name

URL Parameters

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

Example

Request
GET
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches/master
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/branches/master",
  "html_url": "https://app.buddy.works/buddy/company-website/repository/branch/master",
  "name": "master",
  "commit": {
    "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/506a3963507943d6908154f4bc9646e829128a08",
    "html_url": "https://app.buddy.works/buddy/company-website/repository/commit/506a3963507943d6908154f4bc9646e829128a08",
    "revision": "506a3963507943d6908154f4bc9646e829128a08",
    "author_date": "2016-01-19T12:36:33Z",
    "commit_date": "2016-01-19T12:36:33Z",
    "message": "init repo\n",
    "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"
    }
  },
  "description": "",
  "default": true
}

Add a branch

Creates a new branch in the project repository.
Required scopes: WORKSPACE, REPOSITORY_WRITE

Resource URL

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

URL Parameters

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

POST Parameters

Name Description
commit Commit
description String The description of the branch.
name String The unique name of the branch.

Example

Request
POST
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches
{
  "name": "dev",
  "description": "development branch",
  "commit": {
    "revision": "506a3963507943d6908154f4bc9646e829128a08"
  }
}
Sample Response
Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
{
  "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches/dev",
  "html_url": "https://app.buddy.works/buddy/company-website/repository/branch/dev",
  "name": "dev",
  "commit": {
    "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/506a3963507943d6908154f4bc9646e829128a08",
    "html_url": "https://app.buddy.works/buddy/company-website/repository/commit/506a3963507943d6908154f4bc9646e829128a08",
    "revision": "506a3963507943d6908154f4bc9646e829128a08",
    "author_date": "2016-01-19T12:36:33Z",
    "commit_date": "2016-01-19T12:36:33Z",
    "message": "init repo\n",
    "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"
    }
  },
  "description": "development branch",
  "default": false
}

Delete branch

Removes the branch.
Required scopes: WORKSPACE, REPOSITORY_WRITE

Resource URL

DELETE
/workspaces/:domain/projects/:project_name/repository/branches/:name

URL Parameters

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

GET Parameters

Name Description
force Boolean Required when the revision is not merged.

Example

Request
DELETE
https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches/dev
Sample Response
Status: 204 NoContent
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999