Deployments

The Deployments API allows you to access deployment history and trigger new deployments on your account.

Trigger a deployment

Querystring parameters

environment_id Required
ID of environment
user_id ID of user who triggered deployment, defaults to account owner
deployed_version Version (Git commit) of deployed release, default latest
deploy_from_scratch Indicates whether the deployment was made from scratch, default false
trigger_notifications Indicates whether notification should be triggered, default true
skip_build Indicates whether assets should be built or not, default true
comment Comment provided by user
POST

/deployments

Example request with cURL

curl "https://yoursubdomain.deploybot.com/api/v1/deployments" \
  -X POST \
  -H "X-Api-Token: api-token"
  -d '{"environment_id":1,"user_id":2,"deployed_version":"3d6c203d89b526f14ebf17e8282b616572c583a9","deploy_from_scratch":false,"trigger_notifications":true,"comment":"Deploy via API"}'

Response

id integer ID of deployment
repository_id integer ID of repository
environment_id integer ID of environment
user_id integer ID of user who triggered deployment
deployed_version string Version (Git commit) of deployed release
deploy_from_scratch boolean Indicates whether the deployment was made from scratch
trigger_notifications boolean Indicates whether notification should be triggered, default true
is_automatic boolean Indicates whether the deployment was automatic, always false for deployments via the API
comment string Comment provided by user
author_name string Cached name of user who triggered deployment
state string Deployment state, one of following values: pending, waiting, failed, success, skipped
retries integer Number of retries attempted by user
created_at string Creation timestamp
deployed_at string Deployment timestamp

Example response

HTTP/1.1 200 OK
Content-Type: application/json
{ 
  "id": 8,
  "repository_id": 1,
  "environment_id": 1,
  "user_id": 2,
  "deployed_version": "3d6c203d89b526f14ebf17e8282b616572c583a9",
  "deploy_from_scratch": false,
  "trigger_notifications": true,
  "is_automatic": true,
  "comment": "Deploy via API",
  "author_name": "Jennifer Awson",
  "state": "waiting",
  "retries": 0,
  "created_at": "2015/03/16 18:04:53 +0000",
  "deployed_at": null
}

Get a deployment

GET

/deployments/:deploymentid

Example request with cURL

curl "https://yoursubdomain.deploybot.com/api/v1/deployments/42" \
  -X GET \
  -H "X-Api-Token: api-token"

Response

id integer ID of deployment
repository_id integer ID of repository
environment_id integer ID of environment
user_id integer ID of user who triggered deployment
deployed_version string Version (Git commit) of deployed release
deploy_from_scratch boolean Indicates whether the deployment was made from scratch
trigger_notifications boolean Indicates whether notification should be triggered, default true
is_automatic boolean Indicates whether the deployment was automatic
comment string Comment provided by user
author_name string Cached name of user who triggered deployment
state string Deployment state, one of following values: pending, waiting, failed, success, skipped
retries integer Number of retries attempted by user
created_at string Creation timestamp
deployed_at string Deployment timestamp

Example response

HTTP/1.1 200 OK
Content-Type: application/json
{ 
  "id": 42,
  "repository_id": 1,
  "environment_id": 1,
  "user_id": 2,
  "deployed_version": "3d6c203d89b526f14ebf17e8282b616572c583a9",
  "deploy_from_scratch": false,
  "trigger_notifications": true,
  "is_automatic": true,
  "comment": "Deploy via API",
  "author_name": "Artem Chistyakov",
  "state": "skipped",
  "retries": 0,
  "created_at": "2015/03/16 18:04:53 +0000",
  "deployed_at": "2015/03/16 18:07:26 +0000"
}

List deployments

Querystring parameters

repository_id Required
ID of repository to filter results by. Required if environment_id is null.
environment_id Required
ID of environment to filter results by. Required if repository_id is null.
limit Max number of deployments to return per request (default 10, max 20)
after ID of last user returned by previous request. Used for paging results.
GET

/deployments

Example request with cURL

curl "https://yoursubdomain.deploybot.com/api/v1/deployments?limit=2&after=42" \
  -X GET \
  -H "X-Api-Token: api-token"

Response

meta object
meta/next integer Next page’s after parameter’s value
meta/next_uri string Next page’s URI when the query results do not fit on a single page
meta/total integer Total number of deployments
entries array List of deployments matching the query
entries/id integer ID of deployment
entries/repository_id integer ID of repository
entries/environment_id integer ID of environment
entries/user_id integer ID of user who triggered deployment
entries/deployed_version string Version (Git commit) of deployed release
entries/deploy_from_scratch boolean Indicates whether the deployment was made from scratch
entries/trigger_notifications boolean Indicates whether notification should be triggered, default true
entries/is_automatic boolean Indicates whether the deployment was automatic
entries/comment string Comment provided by user
entries/author_name string Cached name of user who triggered deployment
entries/state string Deployment state, one of following values: pending, waiting, failed, success, skipped
entries/retries integer Number of retries attempted by user
entries/created_at string Creation timestamp
entries/deployed_at string Deployment timestamp

Example response

HTTP/1.1 200 OK
Content-Type: application/json
{ 
  "meta": {
    "next": 48,
    "next_uri": "/deployments?after=48&limit=2",
    "total": 3
  },
  "entries": [
    {
      "id": 42,
      "repository_id": 1,
      "environment_id": 1,
      "user_id": 2,
      "deployed_version": "3d6c203d89b526f14ebf17e8282b616572c583a9",
      "deploy_from_scratch": false,
      "trigger_notifications": true,
      "is_automatic": true,
      "comment": "Deploy via API",
      "author_name": "Artem Chistyakov",
      "state": "skipped",
      "retries": 0,
      "created_at": "2015/03/16 18:04:53 +0000",
      "deployed_at": "2015/03/16 18:07:26 +0000"
    }
  ]
}