Beanstalk

Server Environment Resource

Server Environment is a resource that represents a group of Release Servers. Server Environment can have multiple Release Servers associated with it.

Readable attributes

id integer Unique UD of the ServerEnvironment.
account_id integer ID of the associated Account.
repository_id integer ID of the associated Repository.
name string Human-readable name of the environment.
branch_name string For Git repositories it means the branch which this environment will be deploying.
automatic boolean True if environment should be deployed automatically on every commit/push.
color_label string See list of available labels below.
current_version string Revision number or hash of the last commit deployed to the environment.
updated_at datetime Time when the environment was last updated.
created_at datetime Time when the environment was first added to the system.

Writable attributes

name string Must be unique for Repository. Can not be longer than 20 chars. Required on create.
branch_name string Required on create for Git repositories. Should point to an existing branch.
automatic boolean Optional.
color_label string Optional. One of the labels from the list below.

Available color labels

  • label-white
  • label-pink
  • label-red
  • label-red-orange
  • label-orange
  • label-yellow
  • label-yellow-green
  • label-aqua-green
  • label-green
  • label-green-blue
  • label-sky-blue
  • label-light-blue
  • label-blue
  • label-orchid
  • label-violet
  • label-brown
  • label-black
  • label-grey

Find All Server Environments

json http-request
GET /api/{REPOSITORY_ID}/server_environments.json

Click to expand…

json http-response
[
  {
    "server_environment": {
      "name": "Development",
      "created_at": "2011/10/05 15:14:52 +0800",
      "updated_at": "2011/10/05 15:14:52 +0800",
      "automatic": false,
      "account_id": 2,
      "id": 1,
      "current_version": null,
      "repository_id": 13,
      "color_label": "label-yellow",
      "branch_name": "development"
    }
  }
]
xml http-request
GET /api/{REPOSITORY_ID}/server_environments.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<server-environments type="array">
  <server-environment>
    <account-id type="integer">4</account-id>
    <automatic type="boolean">true</automatic>
    <branch-name>production</branch-name>
    <created-at type="datetime">2010-07-01T13:58:55+08:00</created-at>
    <current-version>319dded3c14a2f901686b98fc58d5026f102ba65</current-version>
    <id type="integer">6</id>
    <name>Mascarpone</name>
    <repository-id type="integer">58</repository-id>
    <color-label>label-yellow</color-label>
    <updated-at type="datetime">2010-08-09T11:32:53+08:00</updated-at>
  </server-environment>
  <server-environment>
    <account-id type="integer">4</account-id>
    <automatic type="boolean">true</automatic>
    <branch-name>staging</branch-name>
    <created-at type="datetime">2010-07-01T14:20:37+08:00</created-at>
    <current-version>f17b73d207feb8ec21ad43dc8fafc20e934d7c04</current-version>
    <id type="integer">7</id>
    <name>The Staging</name>
    <repository-id type="integer">58</repository-id>
    <color-label>label-yellow</color-label>
    <updated-at type="datetime">2010-07-06T19:58:20+08:00</updated-at>
  </server-environment>
</server-environments>

Find Server Environment

json http-request
GET /api/{REPOSITORY_ID}/server_environments/{SERVER_ENVIRONMENT_ID}.json

Click to expand…

json http-response
{
  "server_environment": {
    "name": "Development",
    "created_at": "2011/10/05 15:14:52 +0800",
    "updated_at": "2011/10/05 15:14:52 +0800",
    "automatic": false,
    "account_id": 2,
    "id": 1,
    "current_version": null,
    "repository_id": 13,
    "color_label": "label-yellow",
    "branch_name": "development"
  }
}
xml http-request
GET /api/{REPOSITORY_ID}/server_environments/{SERVER_ENVIRONMENT_ID}.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<server-environment>
  <account-id type="integer">4</account-id>
  <automatic type="boolean">true</automatic>
  <branch-name>production</branch-name>
  <created-at type="datetime">2010-07-01T13:58:55+08:00</created-at>
  <current-version>319dded3c14a2f901686b98fc58d5026f102ba65</current-version>
  <id type="integer">6</id>
  <name>Mascarpone</name>
  <repository-id type="integer">58</repository-id>
  <color-label>label-yellow</color-label>
  <updated-at type="datetime">2010-08-09T11:32:53+08:00</updated-at>
</server-environment>

Create Server Environment

See the list of writable attributes at the top of the page. Only name attribute and branch_name (for Git repos) are required for creation.

json http-request
POST /api/{REPOSITORY_ID}/server_environments.json
{
  "server_environment": {
    "name": "Production",
    "automatic": true,
    "branch_name": "development"
  }
}

Click to expand…

json http-response
{
  "server_environment": {
    "name": "Production",
    "created_at": "2011/10/05 15:14:52 +0800",
    "updated_at": "2011/10/05 15:14:52 +0800",
    "automatic": true,
    "account_id": 2,
    "id": 1,
    "current_version": null,
    "repository_id": 13,
    "color_label": "label-yellow",
    "branch_name": "development"
  }
}

--OR IF INVALID--

{
  "errors": ["Error message"]
}
xml http-request
POST /api/{REPOSITORY_ID}/server_environments.xml
<?xml version="1.0" encoding="UTF-8"?>
<server-environment>  
  <name>The Development</name>
</server-environment>

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<server-environment>
  <account-id type="integer">4</account-id>
  <automatic type="boolean">true</automatic>
  <branch-name>production</branch-name>
  <created-at type="datetime">2010-07-01T13:58:55+08:00</created-at>
  <current-version>319dded3c14a2f901686b98fc58d5026f102ba65</current-version>
  <id type="integer">12</id>
  <name>The Development</name>
  <repository-id type="integer">58</repository-id>
  <color-label>label-yellow</color-label>
  <updated-at type="datetime">2010-08-09T11:32:53+08:00</updated-at>
</server-environment>

--OR IF INVALID--

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

Update Server Environment

See the list of writable attributes at the top of the page. You only need to pass the attributes that you want to change.

json http-request
PUT /api/{REPOSITORY_ID}/server_environments/{SERVER_ENVIRONMENT_ID}.json
{
  "server_environment": {
    "automatic": false
  }
}

Click to expand…

json http-response
{
  "server_environment": {
    "name": "Production",
    "created_at": "2011/10/05 15:14:52 +0800",
    "updated_at": "2011/10/05 15:14:52 +0800",
    "automatic": false,
    "account_id": 2,
    "id": 1,
    "current_version": null,
    "repository_id": 13,
    "color_label": "label-yellow",
    "branch_name": "development"
  }
}

--OR IF INVALID--

{
  "errors": ["Error message"]
}
xml http-request
PUT /api/{REPOSITORY_ID}/server_environments/{SERVER_ENVIRONMENT_ID}.xml
<?xml version="1.0" encoding="UTF-8"?>
<server-environment>  
  <name>The Development</name>
</server-environment>

Click to expand…

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

<?xml version="1.0" encoding="UTF-8"?>
<errors>
  <error>Name must be unique in repository.</error>
</errors>

Delete Server Environment

json http-request
DELETE /api/{REPOSITORY_ID}/server_environments/{SERVER_ENVIRONMENT_ID}.json

Click to expand…

json http-response
HEAD 200 OK
xml http-request
DELETE /api/{REPOSITORY_ID}/server_environments/{SERVER_ENVIRONMENT_ID}.xml

Click to expand…

xml http-response
HEAD 200 OK