Branches

Branches are currently in private beta. Contact us to try it out. This API endpoint may change in the future.

Branch creation

Branches will be created asynchronously. State of branch creation is returned as state.

Available States

State Description
initialized Data received.
processing Branch is currently creating.
success Branch was created successfully
error Branch creation failed.

GET /v2/projects/:project_id/branches

List all branches the of the current project.

This endpoint is paginated.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/branches" \
  -u USERNAME_OR_ACCESS_TOKEN
phraseapp branches list <project_id>

Response

Status: 200
[ { "name": "new-branch", "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "merged_at": "2015-01-28T09:52:53Z", "merged_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "created_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "state": "success" }, { "name": "new-branch", "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "merged_at": "2015-01-28T09:52:53Z", "merged_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "created_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "state": "success" } ]

GET /v2/projects/:project_id/branches/:id

Get details on a single branch for a given project.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/branches/:id" \
  -u USERNAME_OR_ACCESS_TOKEN
phraseapp branch show <project_id> <id>

Response

Status: 200
{ "name": "new-branch", "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "merged_at": "2015-01-28T09:52:53Z", "merged_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "created_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "state": "success" }

POST /v2/projects/:project_id/branches

Create a new branch.

Parameters

Name Type Description
name string Name of the branch

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/branches" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X POST \
  -d '{"name":"my-branch"}' \
  -H 'Content-Type: application/json'
phraseapp branch create <project_id> \
--name my-branch

Response

Status: 201
{ "name": "new-branch", "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "merged_at": "2015-01-28T09:52:53Z", "merged_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "created_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "state": "success" }

PATCH /v2/projects/:project_id/branches/:id

Update an existing branch.

Parameters

Name Type Description
name string Name of the branch

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/branches/:id" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X PATCH \
  -d '{"name":"my-branch"}' \
  -H 'Content-Type: application/json'
phraseapp branch update <project_id> <id> \
--name my-branch

Response

Status: 200
{ "name": "new-branch", "created_at": "2015-01-28T09:52:53Z", "updated_at": "2015-01-28T09:52:53Z", "merged_at": "2015-01-28T09:52:53Z", "merged_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "created_by": { "id": "abcd1234cdef1234abcd1234cdef1234", "username": "joe.doe", "name": "Joe Doe" }, "state": "success" }

DELETE /v2/projects/:project_id/branches/:id

Delete an existing branch.

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/branches/:id" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X DELETE
phraseapp branch delete <project_id> <id>

Response

Status: 204

PATCH /v2/projects/:project_id/branches/:id/merge

Merge an existing branch.

Parameters

Name Type Description
strategy
optional
string strategy used for merge blocking, use_master or use_branch
Default: blocking

Example Request

curl "https://api.phraseapp.com/api/v2/projects/:project_id/branches/:id/merge" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X PATCH \
  -d '{"strategy":"use_master"}' \
  -H 'Content-Type: application/json'
phraseapp branch merge <project_id> <id> \
--strategy use_master

Response

Status: 200