Beanstalk

Release Resource

The release model is associate with the Release Server model, which allows you to deploy your code via FTP or SFTP to your web server.

Writable attributes

  • revision — what revision of the server to deploy;
  • comment — text that will be displayed in the release notes;
  • deploy_from_scratch — deploy from the first revision rather then doing incremental deployment;
  • environment_id — environment you want to deploy to;
  • do_not_notify – do not trigger email notification for this deployment.

Readable attributes

  • retries – retries counter;
  • auto – “true” of “false” – was deployment triggered automatically?

Possible states

  • pending — deployment in progress;
  • waiting — deployment waiting in queue to be processed;
  • failed — deployment failed;
  • success — deployment successful;
  • skipped — deployment bypassed.

Find All Releases for Account

Optional GET parameters:

  • page (integer) — page number for pagination;
  • per_page (integer) — number of elements per page (default 10, maximum 50).
json http-request
GET /api/releases.json

Click to expand…

json http-response
[
  {
    "release": {
      "state": "success",
      "id": 183,
      "auto": true,
      "updated_at": "2013/01/19 00:18:18 +0800",
      "skipped": false,
      "revision": "2",
      "comment": "test",
      "author": "railsmonk",
      "environment_name": "Dreams",
      "user_id": 6,
      "retried_at": null,
      "account_id": 4,
      "environment_revision": null,
      "environment_branch_name":null,
      "deploy_from_scratch": false,
      "repository_id": 67,
      "environment_id": 32,
      "do_not_notify": false,
      "deployed": true,
      "created_at": "2013/01/17 05:04:08 +0800",
      "retries": 0,
      "deployed_at": "2013/01/17 05:04:35 +0800"
    }
  }
]
xml http-request
GET /api/releases.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<releases type="array">
  <release>
    <id type="integer">183</id>
    <account-id type="integer">4</account-id>
    <repository-id type="integer">67</repository-id>
    <user-id type="integer">6</user-id>
    <environment-id type="integer">32</environment-id>
    <environment-revision nil="true"/>
    <revision>2</revision>
    <comment>test</comment>
    <author>railsmonk</author>
    <deployed-at type="datetime">2013-01-21T16:54:18-05:00</deployed-at>
    <created-at type="datetime">2013-01-21T16:53:29-05:00</created-at>
    <updated-at type="datetime">2013-01-21T16:54:18-05:00</updated-at>
    <retried-at nil="true"/>
    <retries type="integer">0</retries>
    <state>success</state>
    <deploy-from-scratch type="boolean">false</deploy-from-scratch>
    <do-not-notify type="boolean">false</do-not-notify>
    <auto type="boolean">true</auto>
    <environment-name>Dreams</environment-name>
    <environment-branch-name nil="true"></environment-branch-name>
    <deployed type="boolean">true</deployed>
    <bypassed type="boolean">false</bypassed>
  </release>
</releases>

Find All Releases for Repository

Optional GET parameters:

  • page (integer) — page number for pagination;
  • per_page (integer) — number of elements per page (default 10, maximum 50).
json http-request
GET /api/{REPOSITORY_ID}/releases.json

Click to expand…

json http-response
[
  {
    "release": {
        "state": "success",
        "id": 183,
        "auto": true,
        "updated_at": "2013/01/19 00:18:18 +0800",
        "skipped": false,
        "revision": "2",
        "comment": "test",
        "author": "railsmonk",
        "environment_name": "Dreams",
        "user_id": 6,
        "retried_at": null,
        "account_id": 4,
        "environment_revision": null,
        "environment_branch_name":null,
        "deploy_from_scratch": false,
        "repository_id": 67,
        "environment_id": 32,
        "do_not_notify": false,
        "deployed": true,
        "created_at": "2013/01/17 05:04:08 +0800",
        "retries": 0,
        "deployed_at": "2013/01/17 05:04:35 +0800"
    }
  }
]
xml http-request
GET /api/{REPOSITORY_ID}/releases.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<releases type="array">
  <release>
    <id type="integer">183</id>
    <account-id type="integer">4</account-id>
    <repository-id type="integer">67</repository-id>
    <user-id type="integer">6</user-id>
    <environment-id type="integer">32</environment-id>
    <environment-revision nil="true"/>
    <revision>2</revision>
    <comment>test</comment>
    <author>railsmonk</author>
    <deployed-at type="datetime">2013-01-21T16:54:18-05:00</deployed-at>
    <created-at type="datetime">2013-01-21T16:53:29-05:00</created-at>
    <updated-at type="datetime">2013-01-21T16:54:18-05:00</updated-at>
    <retried-at nil="true"/>
    <retries type="integer">0</retries>
    <state>success</state>
    <deploy-from-scratch type="boolean">false</deploy-from-scratch>
    <do-not-notify type="boolean">false</do-not-notify>
    <auto type="boolean">true</auto>
    <environment-name>Dreams</environment-name>
    <environment-branch-name nil="true"></environment-branch-name>
    <deployed type="boolean">true</deployed>
    <bypassed type="boolean">false</bypassed>
  </release>
  <release>
    <id type="integer">184</id>
    <account-id type="integer">4</account-id>
    <repository-id type="integer">67</repository-id>
    <user-id type="integer">6</user-id>
    <environment-id type="integer">32</environment-id>
    <environment-revision nil="true"/>
    <revision>2</revision>
    <comment>test</comment>
    <author>railsmonk</author>
    <deployed-at type="datetime">2013-01-21T16:54:18-05:00</deployed-at>
    <created-at type="datetime">2013-01-21T16:53:29-05:00</created-at>
    <updated-at type="datetime">2013-01-21T16:54:18-05:00</updated-at>
    <retried-at nil="true"/>
    <retries type="integer">0</retries>
    <state>success</state>
    <deploy-from-scratch type="boolean">false</deploy-from-scratch>
    <do-not-notify type="boolean">false</do-not-notify>
    <auto type="boolean">true</auto>
    <environment-name>Dreams</environment-name>
    <environment-branch-name nil="true"></environment-branch-name>
    <deployed type="boolean">true</deployed>
    <bypassed type="boolean">false</bypassed>
  </release>
</releases>

Find Release

json http-request
GET /api/{REPOSITORY_ID}/releases/{RELEASE_ID}.json

Click to expand…

json http-response
{
  "release": {
    "state": "success",
    "id": 183,
    "auto": true,
    "updated_at": "2013/01/19 00:18:18 +0800",
    "skipped": false,
    "revision": "2",
    "comment": "test",
    "author": "railsmonk",
    "environment_name": "Dreams",
    "user_id": 6,
    "retried_at": null,
    "account_id": 4,
    "environment_revision": null,
    "environment_branch_name":null,
    "deploy_from_scratch": false,
    "repository_id": 67,
    "environment_id": 32,
    "do_not_notify": false,
    "deployed": true,
    "created_at": "2013/01/17 05:04:08 +0800",
    "retries": 0,
    "deployed_at": "2013/01/17 05:04:35 +0800"
  }
}
xml http-request
GET /api/{REPOSITORY_ID}/releases/{RELEASE_ID}.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<release>
  <id type="integer">183</id>
  <account-id type="integer">4</account-id>
  <repository-id type="integer">67</repository-id>
  <user-id type="integer">6</user-id>
  <environment-id type="integer">32</environment-id>
  <environment-revision nil="true"/>
  <environment-branch-name nil="true"/>
  <revision>2</revision>
  <comment>test</comment>
  <author>railsmonk</author>
  <deployed-at type="datetime">2013-01-21T16:54:18-05:00</deployed-at>
  <created-at type="datetime">2013-01-21T16:53:29-05:00</created-at>
  <updated-at type="datetime">2013-01-21T16:54:18-05:00</updated-at>
  <retried-at nil="true"/>
  <retries type="integer">0</retries>
  <state>success</state>
  <deploy-from-scratch type="boolean">false</deploy-from-scratch>
  <do-not-notify type="boolean">false</do-not-notify>
  <auto type="boolean">true</auto>
  <environment-name>Dreams</environment-name>
  <deployed type="boolean">true</deployed>
  <bypassed type="boolean">false</bypassed>
</release>

Create Release

Creating a release means requesting a deployment. If you already have some releases in state “new” or “retry”, Beanstalk will delete them after creating a new one.

See the list of writable attributes at the top of the page.

json http-request
POST /api/{REPOSITORY_ID}/releases.json?environment_id={SERVER_ENVIRONMENT_ID}
{
  "release": {
    "comment": "Deployment description or commit message.",
    "revision": "a77a6bafd54c947c029b90d983e987ff4923b110"
  }
}

Click to expand…

json http-response
{
  "release": {
    "state": "new",
    "id": 183,
    "auto": false,
    "updated_at": "2013/01/19 00:18:18 +0800",
    "skipped": false,
    "revision": "a77a6bafd54c947c029b90d983e987ff4923b110",
    "comment": "Deployment description or commit message.",
    "author": "railsmonk",
    "environment_name": "Dreams",
    "user_id": 6,
    "retried_at": null,
    "account_id": 4,
    "environment_revision": null,
    "environment_branch_name": "master",
    "deploy_from_scratch": false,
    "repository_id": 67,
    "environment_id": 32,
    "do_not_notify": false,
    "deployed": false,
    "created_at": "2013/01/17 05:04:08 +0800",
    "retries": 0,
    "deployed_at": null
  }
}
  
--OR IF INVALID--

{
  "errors": ["Error message"]
}
xml http-request
POST /api/{REPOSITORY_ID}/releases.xml?environment_id={SERVER_ENVIRONMENT_ID}
<release>
  <revision type="integer">1</revision>
</release>

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<release>
  <id type="integer">183</id>
  <account-id type="integer">4</account-id>
  <repository-id type="integer">67</repository-id>
  <user-id type="integer">6</user-id>
  <environment-id type="integer">32</environment-id>
  <environment-revision nil="true"/>
  <environment-branch-name>master</environment-branch-name>
  <revision>a77a6bafd54c947c029b90d983e987ff4923b110</revision>
  <comment>Deployment description or commit message.</comment>
  <author>railsmonk</author>
  <deployed-at nil="true"></deployed-at>
  <created-at type="datetime">2013-01-21T16:53:29-05:00</created-at>
  <updated-at type="datetime">2013-01-21T16:54:18-05:00</updated-at>
  <retried-at nil="true"/>
  <retries type="integer">0</retries>
  <state>success</state>
  <deploy-from-scratch type="boolean">false</deploy-from-scratch>
  <do-not-notify type="boolean">false</do-not-notify>
  <auto type="boolean">false</auto>
  <environment-name>Dreams</environment-name>
  <deployed type="boolean">false</deployed>
  <bypassed type="boolean">false</bypassed>
</release>

--OR IF INVALID--

<?xml version="1.0" encoding="UTF-8"?>
<errors>
  <error>Server can't be blank</error>
</errors>

Retry Release

Use this method to retry a failed deployment.

json http-request
PUT /api/{REPOSITORY_ID}/releases/{RELEASE_ID}/retry.json

Click to expand…

json http-response
HEAD 200 OK
  
--OR IF INVALID--

HEAD 422
xml http-request
PUT /api/{REPOSITORY_ID}/releases/{RELEASE_ID}/retry.xml

Click to expand…

xml http-response
HEAD 200 OK

--OR IF INVALID--

HEAD 422