NAV Navbar <<<<<<< Updated upstream
Logo
=======
>>>>>>> Stashed changes

Introduction

Cloud 66 is a full stack container management as a service. It allows you to build, provision, configure and manage Docker containers on your own server on any cloud. You can find more information on Cloud 66 on our help site.

Resource model

The Cloud 66 API is organised around REST. It is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors.

We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients.

JSON will be returned in all responses from the API, including errors (though if you're using API bindings, we will convert the response to the appropriate language-specific object).

Authentication

Cloud 66 uses OAuth2 to authenticate users and grant access to stacks and redeployments. To use it, you need an OAuth 2.0 compatible client. To submit API requests, you must pass an OAuth token. An OAuth token functions as a complete authentication request, acting as a substitute for a username and password pair. Because of this, it is absolutely essential that you keep your OAuth tokens secure.

To authenticate your requests with OAuth you need to send a bearer authorization header with your request. This is the preferred method of authenticating because it completes the authorization request in the header portion, away from the actual request.

Usually, you use a language binding (like a Ruby gem or Go package) to deal with the OAuth authentication. Alternatively, you can include the OAuth authentication token in the header of each request:

Authorization: bearer 5262d64b892e8d4341000001

You can generate an OAuth token by visiting the Apps , under your Account.

How to authenticate with OAuth2

You can generate an OAuth token using the Your Account > Apps area of the Cloud 66 user interface or using the API.

Step 1 - Redirect users to request Cloud 66 access

GET https://app.cloud66.com/oauth/authorize

Parameter Description Presence
client_id The client ID you received from Cloud 66 when you registered. required
redirect_url URL in your app where users will be sent after authorization. required
scope Comma separated list of scopes. optional

Step 2 - Cloud 66 redirects back to your site

If the user accepts your request, Cloud 66 redirects back to your site with a temporary code in a code parameter as well as the state you provided in the previous step in a state parameter. If the states don’t match, the request has been created by a third party and the process should be aborted.

Exchange this for an access token:

POST https://app.cloud66.com/oauth/token

Parameter Description Presence
client_id The client ID you received from Cloud 66 when you registered. required
redirect_url URL in your app where users will be sent after authorization. optional
client_secret The client secret you received from Cloud 66 when you registered. required

Response By default, the response will take the following form:

access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&amp;token_type=bearer
Accept: application/json {"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a","token_type":"bearer"}

Step 3 - Use the access token to access the API

The access token allows you to make requests to the API on behalf of a user.

GET "https://app.cloud66.com/api/3/stack.json" -H "Authorization: Bearer e72e...b4a"

Scoped access

A user’s scope defines the limits of the actions the user can perform with the Cloud 66 API. The user’s scope is encrypted as part of the OAuth access token. Users cannot submit requests not allowed by their defined scopes.

For the web flow, requested scopes be displayed to the user on the authorize form.

Scope Description
(no scope) Users with this scope have public read-only access and can view limited stack information.
public Users with this scope have public read-only access and can view limited stack information.
redeploy Users with this scope can redeploy any stacks they can access.
jobs Users with this scope can view the scheduled jobs for the stacks they can access.
users Users with this scope can manage other users’ mobile devices.
admin Users with this scope can set and manage settings for the servers they can access.

https://app.cloud66.com/oauth/authorize?client_id=...&scope=public+redeploy

Example

require 'rubygems'
require 'oauth2'
require 'json'

base = 'https://app.cloud66.com'
api_url = 'https://app.cloud66.com/api/3'

if File.exists? '/tmp/cloud66_oauth_test.json'
    config = JSON.parse(File.read('/tmp/cloud66_oauth_test.json'))
    client = OAuth2::Client.new(config['app_id'], config['app_secret'], :site => base)
    token = OAuth2::AccessToken.new(client, config['token'])
else
    client = OAuth2::Client.new(ENV['APP_ID'], ENV['APP_SECRET'], :site => base)
    puts client.auth_code.authorize_url(:redirect_uri => 'urn:ietf:wg:oauth:2.0:oob', :scope => 'public admin redeploy')

    puts "Enter the code:"
    code = gets.strip

    token = client.auth_code.get_token(code, :redirect_uri => "urn:ietf:wg:oauth:2.0:oob")

    # save it
    File.write('/tmp/cloud66_oauth_test.json', { :app_id => ENV['APP_ID'], :app_secret => ENV['APP_SECRET'], :token => token.token }.to_json)
end

# Now you can use the token to call API methods, like:

# List all the stacks
response = token.get("#{api_url}/stacks.json")

# list all the servers in the stack
stack_uid = 'ENTER_STACK_UID'
response = token.get("#{api_url}/stacks/#{stack_uid}/servers.json")

# show the response (no error handling)
puts JSON.parse(response.body)['response']
# Simple GET
# Get list of stacks:
curl -X GET "https://app.cloud66.com/api/3/stacks.json" -H "Authorization: Bearer 4c9c9b1111"

# GET with some params
# Get list of all `mysql` backups in `1345` backup group:
curl -X GET "https://app.cloud66.com/api/3/stacks/f196c5b41758cb7977620d49eb1492ef/backups.json" -H "Authorization: Bearer 4c9c9b1111" -d group=1345 -d db_type=mysql

# POST
# Add a new iPhone application to user ID 18 with 'wertqy' as a token:
curl -X POST "https://app.cloud66.com/api/3/users/18/devices.json" -H "Authorization: Bearer 4c9c9b1111" -d token=wertqy -d device_type=1 -d sub_type=1

# PUT
# Update the type of device with token 'wertqy' to iPad:
curl -X PUT "https://app.cloud66.com/api/3/users/18/devices/wertqy.json" -H "Authorization: Bearer 4c9c9b1111" -d device_type=1 -d sub_type=2

# DELETE
# Delete device with token 'wertqy':
curl -X DELETE "https://app.cloud66.com/api/3/users/18/devices/wertqy.json" -H "Authorization: Bearer 4c9c9b1111"

Ruby

This example shows how to get the first token using the Application (Client) ID and Secret. This is using urn:ietf:wg:oauth:2.0:oob for command line tools.

Once you have the code, you can apply for a token. Tokens issued by the API server do not expire and are valid until the user revokes their access. You can see how to store and retrieve the token for future use in this example.

cURL

For example, you can get lists of stacks with this command:

curl -X GET "https://app.cloud66.com/api/3/stacks.json" -H "Authorization: Bearer PERSONAL_ACCESS_TOKEN"`

You can use your personal access token to call the API with cURL - it just needs to be passed in as a header.

Assuming that your personal access token is 4c9c9b1111, you can find some examples for using cURL.

Go Example

You can use the Cloud 66 Go library repository if you want to use Go.

Synchronous vs. asynchronous requests

#Asynchronous example
stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/actions.json", {body: {:command => 'clear_caches'}})

#Get the action ID
id = JSON.parse(response.body)['response']['id']
puts "Started action with ID: #{id}"

...

#After some time check status
response = token.get("#{api_url}/stacks/#{stack_id}/actions/#{id}.json")

result = JSON.parse(response.body)['response']

#Check if the request finished successfully
if result['finished_success']=='true'
  puts 'Success!'
else
  puts "Failed. Error: #{result['finished_message']}"
end

The Cloud 66 API uses both synchronous and asynchronous methods. Asynchronous methods are specified in the documentation for the associated calls; all others are generally considered synchronous.

Synchronous methods will wait for the server to return a response for the request before it will continue processing. Your application will not perform any additional actions until it receives a response from the server.

Asynchronous methods will submit the request to the server, but the application will not wait for a response from the server to continue processing. When the server returns a response, the application can execute a callback function to retrieve the response object, but will continue processing until the response is received.

Date formats

Cloud 66 accepts and returns date values according to the ISO 8601 standard. Combined date and time values appear in UTC including local time zone offsets. For example: 2014-06-15T14:13:18+00:00

Rate limiting

The Cloud 66 API can receive a maximum of 3,000 requests per user per hour. When the request level reaches the maximum rate, subsequent requests will return a 503: throttled HTTP status message and the user must retry the request in the next hourly interval.

Standard HTTP response statuses

Requests made using the Cloud 66 API can return any of the following response status codes.

Code Message Description
200 ok The request completed successfully.
400 bad_request The system cannot parse the request syntax. It might be missing required parameters or include an invalid value.
401 unauthenticated No authentication token was passed in the request.
402 trial_expired The user’s Cloud 66 trial period has expired.
403 forbidden The user does not have the scope required to submit this request.
404 not_found The system cannot find a response for this request URI.
408 time_out The system did not return a response before the server timed out.
409 conflict The system did not return a response because there is a current conflict with the resource.
503 not_implemented This resource is not actively implemented in this version of the Cloud 66 API.
503 throttled The user has reached or exceeded the maximum rate limit and must wait until the next hourly interval to retry the request.

Stack UID retrieval

Many requests in the Cloud 66 API rely on the Stack UID value, an alphanumeric string that uniquely identifies your stack. You can retrieve this value by accessing the Stack information page from the right sidebar of your stack page or by submitting an API request to list all stacks. The Stack UID appears in the response body for each stack you maintain.

Cloud vendor instance names

Amazon Web Services

Instance size Value
Compute optimized c1.medium
Compute optimized c1.xlarge
Compute optimized c3.large
Compute optimized c3.xlarge
Compute optimized c3.2xlarge
Compute optimized c3.4xlarge
Compute optimized c3.8xlarge
Compute optimized c4.large
Compute optimized c4.xlarge
Compute optimized c4.2xlarge
Compute optimized c4.4xlarge
Compute optimized c4.8xlarge
Compute optimized cc2.8xlarge
GPU instances cg1.4xlarge
Memory optimized cr1.8xlarge
Storage optimized d2.xlarge
Storage optimized d2.2xlarge
Storage optimized d2.4xlarge
Storage optimized d2.8xlarge
GPU instances g2.2xlarge
GPU instances g2.8xlarge
Storage optimized hi1.4xlarge
Storage optimized hs1.8xlarge
Storage optimized i2.xlarge
Storage optimized i2.2xlarge
Storage optimized i2.4xlarge
Storage optimized i2.8xlarge
General purpose m1.small
General purpose m1.medium
General purpose m1.large
General purpose m1.xlarge
Memory optimized m2.xlarge
Memory optimized m2.2xlarge
Memory optimized m2.4xlarge
General purpose m3.medium
General purpose m3.large
General purpose m3.xlarge
General purpose m3.2xlarge
General purpose m4.large
General purpose m4.xlarge
General purpose m4.2xlarge
General purpose m4.4xlarge
General purpose m4.10xlarge
Memory optimized r3.large
Memory optimized r3.xlarge
Memory optimized r3.2xlarge
Memory optimized r3.4xlarge
Memory optimized r3.8xlarge
Micro instance t1.micro
General purpose t2.nano
General purpose t2.micro
General purpose t2.small
General purpose t2.medium
General purpose t2.large
Memory optimized x1.32xlarge

Azure

Instance size Value
A0 ExtraSmall
A1 Small
A2 Medium
A3 Large
A4 ExtraLarge
A5 A5
A6 A6
A7 A7
A8 A8
A9 A9
A10 A10
A11 A11
D1 Standard_D1
D2 Standard_D2
D3 Standard_D3
D4 Standard_D4
D11 Standard_D11
D12 Standard_D12
D13 Standard_D13
D14 Standard_D14
D1_v2 Standard_D1_v2
D2_v2 Standard_D2_v2
D3_v2 Standard_D3_v2
D4_v2 Standard_D4_v2
D5_v2 Standard_D5_v2
D11_v2 Standard_D11_v2
D12_v2 Standard_D12_v2
D13_v2 Standard_D13_v2
D14_v2 Standard_D14_v2
D15_v2 Standard_D15_v2
DS1 Standard_DS1
DS2 Standard_DS2
DS3 Standard_DS3
DS4 Standard_DS4
DS11 Standard_DS11
DS12 Standard_DS12
DS13 Standard_DS13
DS14 Standard_DS14
DS1_v2 Standard_DS1_v2
DS2_v2 Standard_DS2_v2
DS3_v2 Standard_DS3_v2
DS4_v2 Standard_DS4_v2
DS11_v2 Standard_DS11_v2
DS12_v2 Standard_DS12_v2
DS13_v2 Standard_DS13_v2
DS14_v2 Standard_DS14_v2
DS15_v2 Standard_DS15_v2
F1 Standard_F1
F2 Standard_F2
F4 Standard_F4
F8 Standard_F8
F16 Standard_F16
F1s Standard_F1s
F2s Standard_F2s
F4s Standard_F4s
F8s Standard_F8s
F16s Standard_F16s
G1 Standard_G1
G2 Standard_G2
G3 Standard_G3
G4 Standard_G4
G5 Standard_G5
GS1 Standard_GS1
GS2 Standard_GS2
GS3 Standard_GS3
GS4 Standard_GS4
GS5 Standard_GS5
NV6 Standard_NV6
NV12 Standard_NV12
NV24 Standard_NV24
NC6 Standard_NC6
NC12 Standard_NC12
NC24 Standard_NC24

CloudA Cloud

Instance size Value
512 MB - General Purpose 512 MB
1 GB - General Purpose 1 GB
2 GB - General Purpose 2 GB
4 GB - General Purpose 4 GB
8 GB - General Purpose 8 GB
16 GB - General Purpose 16 GB
32 GB - General Purpose 32 GB
8 GB - High Memory 8 GB - HM
16 GB - High Memory 16 GB - HM
32 GB - High Memory 32 GB - HM
4 GB - High Compute 4 GB - HC
8 GB - High Compute 8 GB - HC
16 GB - High Compute 16 GB - HC

Digital Ocean

Instance size Value
512MB - 1 CPU 512mb
1GB - 1 CPU 1gb
2GB - 2 CPU 2gb
4GB - 2 CPU 4gb
8GB - 4 CPU 8gb
16GB - 8 CPU 16gb
32GB - 12 CPU 32gb
48GB - 16 CPU 48gb
64GB - 20 CPU 64gb

Google Compute Engine

Instance size Value
f1-micro f1-micro
g1-small g1-small
n1-highcpu-2 n1-highcpu-2
n1-highcpu-4 n1-highcpu-4
n1-highcpu-8 n1-highcpu-8
n1-highcpu-16 n1-highcpu-16
n1-highcpu-32 n1-highcpu-32
n1-highmem-2 n1-highmem-2
n1-highmem-4 n1-highmem-4
n1-highmem-8 n1-highmem-8
n1-highmem-16 n1-highmem-16
n1-highmem-32 n1-highmem-32
n1-standard-1 n1-standard-1
n1-standard-2 n1-standard-2
n1-standard-4 n1-standard-4
n1-standard-8 n1-standard-8
n1-standard-16 n1-standard-16
n1-standard-32 n1-standard-32

Linode

Instance size Value
Linode 2048 Linode 2048
Linode 4096 Linode 4096
Linode 8192 Linode 8192
Linode 12288 Linode 12288
Linode 16384 Linode 16384
Linode 24576 Linode 24576
Linode 32768 Linode 32768
Linode 49152 Linode 49152
Linode 65536 Linode 65536
Linode 98304 Linode 98304
Linode 122880 Linode 122880

Packet Cloud

Instance size Value
Type 0 baremetal_0
Type 1 baremetal_1
Type 3 baremetal_3

Rackspace

Instance size Value
512MB Standard Instance 512MB Standard Instance
1GB Standard Instance 1GB Standard Instance
2GB Standard Instance 2GB Standard Instance
4GB Standard Instance 4GB Standard Instance
8GB Standard Instance 8GB Standard Instance
15GB Standard Instance 15GB Standard Instance
30GB Standard Instance 30GB Standard Instance
3.75 GB Compute v1 3.75 GB Compute v1
7.5 GB Compute v1 7.5 GB Compute v1
15 GB Compute v1 15 GB Compute v1
30 GB Compute v1 30 GB Compute v1
60 GB Compute v1 60 GB Compute v1
1 GB General Purpose v1 1 GB General Purpose v1
2 GB General Purpose v1 2 GB General Purpose v1
4 GB General Purpose v1 4 GB General Purpose v1
8 GB General Purpose v1 8 GB General Purpose v1
15 GB I/O v1 15 GB I/O v1
30 GB I/O v1 30 GB I/O v1
60 GB I/O v1 60 GB I/O v1
90 GB I/O v1 90 GB I/O v1
120 GB I/O v1 120 GB I/O v1
15 GB Memory v1 15 GB Memory v1
30 GB Memory v1 30 GB Memory v1
60 GB Memory v1 60 GB Memory v1
120 GB Memory v1 120 GB Memory v1
240 GB Memory v1 240 GB Memory v1
1 GB Performance 1 GB Performance
2 GB Performance 2 GB Performance
4 GB Performance 4 GB Performance
8 GB Performance 8 GB Performance
15 GB Performance 15 GB Performance
30 GB Performance 30 GB Performance
60 GB Performance 60 GB Performance
90 GB Performance 90 GB Performance
120 GB Performance 120 GB Performance

Vexxhost Cloud

Instance size Value
512MB nb.512M
1GB nb.1G
2GB nb.2G
4GB nb.4G
8GB nb.8G
16GB nb.16G
24GB nb.24G
32GB nb.32G
48GB nb.48G
64GB nb.64G

Cloud vendor instance regions

Amazon Web Services

Region Value
US East (Northern Virginia) us-east-1
US East (Ohio) us-east-2
US West (Northern California) us-west-1
US West (Oregon) us-west-2
Canada (Central) ca-central-1
South America (Sao Paulo, Brazil) sa-east-1
Europe (Dublin, Ireland) eu-west-1
Europe (London) eu-west-2
Europe (Frankfurt) eu-central-1
Asia Pacific (Tokyo) ap-northeast-1
Asia Pacific (Seoul) ap-northeast-2
Asia Pacific (Singapore) ap-southeast-1
Asia Pacific (Sydney) ap-southeast-2
Asia Pacific (Mumbai) ap-south-1

Azure

Region Value
Central US Central US
East US East US
East US 2 East US 2
North Central US North Central US
South Central US South Central US
West Central US West Central US
West US West US
West US 2 West US 2
Canada Central Canada Central
Canada East Canada East
North Europe North Europe
West Europe West Europe
East Asia East Asia
Southeast Asia Southeast Asia
Japan East Japan East
Japan West Japan West
Brazil South Brazil South
Australia East Australia East
Australia Southeast Australia Southeast

CloudA Cloud

Region Value
default default

Digital Ocean

Region Value
Amsterdam, Netherlands ams1
Amsterdam, Netherlands (2nd Data Center) ams2
Amsterdam, Netherlands (3rd Data Center) ams3
Frankfurt, Germany fra1
New York, US nyc1
New York 2, US nyc2
New York 3, US nyc3
San Francisco, US sfo1
Singapore sgp1
London lon1

Google Compute Engine

Zone Value
Eastern US (B) us-east1-b
Eastern US (C) us-east1-c
Eastern US (D) us-east1-d
Central US (A) us-central1-a
Central US (B) us-central1-b
Central US (C) us-central1-c
Central US (F) us-central1-f
Western US (A) us-west1-a
Western US (B) us-west1-b
Western Europe (B) europe-west1-b
Western Europe (C) europe-west1-c
Western Europe (D) europe-west1-d
Eastern Asia (A) asia-east1-a
Eastern Asia (B) asia-east1-b
Eastern Asia (C) asia-east1-c

Linode

Region Value
Atlanta, GA, USA Atlanta, GA, USA
Dallas, TX, USA Dallas, TX, USA
Frankfurt, DE Frankfurt, DE
Fremont, CA, USA Fremont, CA, USA
London, England, UK London, England, UK
Newark, NJ, USA Newark, NJ, USA
Tokyo, JP Tokyo, JP
Singapore, SG Singapore, SG

Packet Cloud

Region Value
Parsippany, NJ ewr1

Rackspace

Region Value
Chicago chicago
Dallas dallas
Hong Kong hong_kong
London london
Northern Virginia northern_virginia
Sydney sydney

Vexxhost Cloud

Region Value
Montreal default

Stacks

Methods

Using the Stacks endpoint, you can submit requests using the following methods.

  • List all stacks
  • View a stack
  • Create a new stack (Docker only)
  • List all stack actions
  • View a stack action
  • Perform a stack action

Stack List

response = token.get("#{api_url}/stacks.json")

puts JSON.parse(response.body)['response']
GET /stacks HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
    "response": [
        {
            "uid": "5999b763474b0eafa5fafb64bff0ba80",
            "name": "Awesome App",
            "git": "http://github.com/cloud66-samples/awesome-app.git",
            "git_branch": "fig",
            "environment": "production",
            "cloud": "DigitalOcean",
            "fqdn": "awesome-app.dev.c66.me",
            "language": "ruby",
            "framework": "rails",
            "status": 1,
            "health": 3,
            "last_activity": "2014-08-14T01:46:53+00:00",
            "last_activity_iso": "2014-08-14T01:46:53+00:00",
            "maintenance_mode": false,
            "has_loadbalancer": false,
            "created_at": "2014-08-14 00:38:14 UTC",
            "updated_at": "2014-08-14 01:46:52 UTC",
            "deploy_directory": "/var/deploy/awesome_app",
            "cloud_status": "partial",
            "created_at_iso": "2014-08-14T00:38:14Z",
            "updated_at_iso": "2014-08-14T01:46:52Z",
            "redeploy_hook": "http://hooks.cloud66.com/stacks/redeploy/b806f1c3344eb3aa2a024b23254b75b3/6d677352a6b2eefec6e345ee2b491521"
        }
    ],
    "count": 1,
    "pagination": {
        "previous": null,
        "next": null,
        "current": 1,
        "per_page": 30,
        "count": 1,
        "pages": 1
    }
}

Retrieves a paged list of all the stack objects the user can access.

HTTP Request

GET /stacks

The stack object

Property Data type Description Sample value
uid string The unique identifier of the stack. 5999b763474b0eafa5fafb64bff0ba80
name string The name defined for the stack. My Awesome App
git string The git repository URL associated with the stack. http://github.com/mysamples/awesome-app.git
git_branch string The git repository branch associated with the stack. fig
environment string The environment associated with the stack. production
cloud string The cloud provider associated with the stack. DigitalOcean
fqdn string The fully qualified namespace of the stack. awesome-app.dev.c66.me
language string The programming language of the stack. ruby
framework string The framework used for the stack. rails
status int The current status code for the stack. 1
health int The current health code for the stack. 3
last_activity datetime The date and time the last action was performed for the stack, in UTC datetime. 2014-08-14T01:46:53+00:00
last_activity_iso datetime The date and time the last action was performed for the stack, in UTC datetime 2014-08-14T01:46:53+00:00
maintenance mode bool Whether the stack currently has maintenance mode enabled. false
has_loadbalancer bool Whether the stack has an associated load balancer add-in. false
created_at datetime The date and time the stack was created, in iso8601 format 2014-09-01T19:08:05Z
updated_at datetime The date and time the stack was last modified, in iso8601 format 2014-09-01T19:18:05Z
deploy_directory string The target directory for stack deployment. /var/deploy/awesome_app
cloud_status string The current cloud provider status associated with the stack. partial
redeploy_hook string If applicable, the deploy hook URL associated with the stack. http://hooks.cloud66.com/stacks/redeploy/ b806f1c3344eb3aa2a024b23254b75b3/6d677352a6b2eefec6e345ee2b491521

Stack

id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.get("#{api_url}/stacks/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
"response":
  {
    "uid": "5999b763474b0eafa5fafb64bff0ba80",
      "name": "Awesome App",
      "git": "http://github.com/cloud66-samples/awesome-app.git",
      "git_branch": "fig",
      "environment": "production",
      "cloud": "DigitalOcean",
      "fqdn": "awesome-app.dev.c66.me",
      "language": "ruby",
      "framework": "rails",
      "status": 1,
      "health": 3,
      "last_activity": "2014-08-14T01:46:53+00:00",
      "last_activity_iso": "2014-08-14T01:46:53+00:00",
      "maintenance_mode": false,
      "has_loadbalancer": false,
      "created_at": "2014-08-14 00:38:14 UTC",
      "updated_at": "2014-08-14 01:46:52 UTC",
      "deploy_directory": "/var/deploy/awesome_app",
      "cloud_status": "partial",
      "created_at_iso": "2014-08-14T00:38:14Z",
      "updated_at_iso": "2014-08-14T01:46:52Z",
      "redeploy_hook": "http://hooks.cloud66.com/stacks/redeploy/b806f1c3344eb3aa2a024b23254b75b3/6d677352a6b2eefec6e345ee2b491521"
  }
}

Retrieve the details of the stack specified in the request.

HTTP Request

GET /stacks/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required string Unique identifier of the stack 5999b763474b0eafa5fafb64bff0ba80

Stack status values

Status Code Description
STK_QUEUED 0 Pending analysis
STK_SUCCESS 1 Deployed successfully
STK_FAILED 2 Deployment failed
STK_ANALYSING 3 Analyzing
STK_ANALYSED 4 Analyzed
STK_QUEUED_FOR_DEPLOYING 5 Queued for deployment
STK_DEPLOYING 6 Deploying
STK_TERMINAL_FAILURE 7 Unable to analyze

Stack health status values

Status Code Description
HLT_UNKNOWN 0 Unknown
HLT_BUILDING 1 Building
HLT_PARTIAL 2 Impaired
HLT_OK 3 Healthy
HLT_BROKEN 4 Failed

Stack Create

service_file = File.read('path/to/service.yml')
manifest_file = File.read('path/to/manifest.yml')

#Using manifest.yml
response = token.post("#{api_url}/stacks.json", {body: {:name => 'new_stack_name', :environment => 'production', :service_yaml => service_file, :manifest_yaml => manifest_file}})

#Using separate parameters
response = token.post("#{api_url}/stacks.json", {body: {:name => 'new_stack_name', :environment => 'production', :service_yaml => service_file, :cloud => 'digitalocean', :region => 'ams1', :size => '1gb', :build_type => 'single'}})

puts JSON.parse(response.body)['response']
POST /stacks HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{ "response":
    {
        "id":10,
        "user":"test@cloud66.com",
        "resource_type":"stack",
        "action":"stack_create",
        "resource_id":"283",
        "started_via":"api",
        "started_at":"2015-09-01T19:08:05Z",
        "finished_at":null,
        "finished_success":null,
        "finished_message":null
    }
}

Create and build a new docker stack. Either manifest definition, or cloud, region, size and build_type must be passed as params.

HTTP Request

POST /stacks

Query parameters

Parameter Presence Data type Description Sample value
name required string New stack name new_stack_name
environment required string New stack environment production
service_yaml required string The services definition of the new docker stack service_yaml_serialised
manifest_yaml optional string The manifest definition of the new docker stack manifest_yaml_serialised
cloud optional string Cloud provider to create servers in aws
key_name optional string Name of the cloud provider key (Default or first available key for the cloud if not specified) my_key
region optional string Region within the cloud to create servers in us-east-1
size optional string Size of the server t1.micro
build_type optional string Deploy all services to single or multi servers multi

Stack Action list

id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.get("#{api_url}/stacks/#{id}/actions.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/actions HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
        [
    {
      "id":10,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"clear_caches",
      "resource_id":"283",
      "started_via":"api",
      "started_at":
      "2014-09-01T19:08:05Z",
      "finished_at":"2014-09-01T19:08:09Z",
      "finished_success":true,
      "finished_message":null
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}

Retrieve a paged list of all asynchronous actions performed for the stack specified in the request.

HTTP Request

GET /stacks/{id}/actions

Query parameters

Parameter Presence Data type Description Sample value
id required string Unique identifier of the stack 5999b763474b0eafa5fafb64bff0ba80

The stack action object

Property Data type Description Sample value
id int The numeric identifier of the stack action. Identifiers increment by one for each performed action. 10
user string The email address of the user who performed the stack action. hello@cloud66.com
resource_type string The resource for which the action was performed, which is stack in this case. stack
action string The action that was performed for the stack. restart
resource_id int The unique ID of the resource 283
started_via string The process that initiated the action, which is the UI, API, or command line. api
started_at datetime The date and time the action was initiated, in UTC datetime. 2014-09-01T19:08:05Z
finished_at datetime The date and time the action was completed, in UTC datetime. 2014-09-01T19:08:09Z
finished_success bool Whether the action completed successfully. true
finished_message string If applicable, the system message associated with the completed action. null

Stack Action

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = '202161'
response = token.get("#{api_url}/stacks/#{stack_id}/actions/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/actions/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":10,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"clear_caches",
      "resource_id":"283",
      "started_via":"api",
      "started_at":
      "2014-09-01T19:08:05Z",
      "finished_at":"2014-09-01T19:08:09Z",
      "finished_success":true,
      "finished_message":null
    }
}

Retrieve the details of an asynchronous action performed for the the stack specified in the request based on the supplied action ID.

HTTP Request

GET /stacks/{stack_id}/actions/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string Unique identifier of the stack 5999b763474b0eafa5fafb64bff0ba80
id required integer Identifier of the asynchronous action 4153

Run Stack action

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/actions.json", {body: {:command => 'clear_caches'}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/actions HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":10,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"clear_caches",
      "resource_id":"283",
      "started_via":"api",
      "started_at":"2014-09-01T19:08:05Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

Perform an asynchronous action for the stack specified in the request. You can use this method to restart the stack, clear the stack's cache, or enable maintenance mode.

HTTP Request

POST /stacks/{stack_id}/actions

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string Unique identifier of the stack 5999b763474b0eafa5fafb64bff0ba80
command required string The action to perform for the stack. Valid values are clear_caches, maintenance_mode, and restart. restart
Command Comments Extra Parameters
maintenance_mode Enable to Disable maintenance mode for a stack.
  • value:1 for enable or 0 for disable
clear_caches Clear git caches for the stack None
restart Restarts all stack components (nginx, db, etc.) None
promote_slave_db Promote the specified slave database server to a standalone master
  • server:server-name
  • server_group: valid values all, mysql, postgresql, redis, mongodb
resync_slave_db Re-sync the specified slave database server with its master database server
  • server:server-name
  • server_group: valid values all, mysql, postgresql, redis, mongodb
container_restart Restarts a particular container on the given stack
  • container:5999b763474b0eafa5fafb64bff0ba80
service_restart Restarts all the containers from the given service
  • service_name:web
  • server_id_filter:f8468fc145ea49bac474b30a8fea888d (optional)

Reboot the Stack

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/reboot_servers.json")

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/reboot_servers HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":10,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"stack_reboot",
      "resource_id":"283",
      "started_via":"api",
      "started_at":"2016-01-01T19:08:05Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

You can use this method to reboot the stack or speific server group of a stack.

HTTP Request

POST /stacks/{stack_id}/reboot_servers

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string Unique identifier of the stack 5999b763474b0eafa5fafb64bff0ba80
strategy required string parallel or serial parallel
group optional string all or web/db/redis etc (default is web) mysql

Processes

Processes list

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{stack_id}/processes.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/processes HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "md5":"5999b763474b0eafa5fafb64bff0ba80",
      "name":"worker",
      "command":"bundle exec rake jobs:work",
      "servers":{"server_name":1}
    },
    {
      "md5":"1230fd91f8c9e4e56c1b14dd0391702",
      "name":"scheduler",
      "command":"bundle exec rake jobs:schedule",
      "servers":{"server_name":1}
    }
  ],
  "count":2,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":2,
      "pages":1
    }
}

Get list of all processes of stack.

HTTP Request

GET /stacks/{id}/processes

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string stack UID 5999b763474b0eafa5fafb64bff0ba80
server_uid optional integer server UID e63e859d5ab72b0bcf14321f0ffb013d

Process Single one

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
id = 4153
response = token.get("#{api_url}/stacks/#{stack_id}/processes.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/processes/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "md5":"5999b763474b0eafa5fafb64bff0ba80",
      "name":"worker",
      "command":"bundle exec rake jobs:work",
      "servers":{"server_name1":1}
    },
    {
      "md5":"1230fd91f8c9e4e56c1b14dd0391702",
      "name":"scheduler",
      "command":"bundle exec rake jobs:schedule",
      "servers":{"server_name1":3}
    }
  ],
  "count":2,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":2,
      "pages":1
    }
}

Get information about a single process.

HTTP Request

GET /stacks/{stack_id}/processes/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string Process Name worker
server_uid optional integer Server ID e63e859d5ab72b0bcf14321f0ffb013d

Scale a Process

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.post("#{api_url}/stacks/#{stack_id}/processes.json")

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/processes HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Accept: application/json
Content-Type: application/json

{
  "response": [
    {
      "id":10,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"Process_scale",
      "resource_id":"283",
      "started_via":"api",
      "started_at":"2016-01-01T19:08:05Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
  ]
}

Scale up a process.

HTTP Request

POST /stacks/{stack_id}/processes

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
process_name required string process name scheduler
server_count required string hash of {server_uid:count} e63e859d5ab72b0bcf14321f0ffb013d:4

Deployments

Deployment list

id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.get("#{api_url}/stacks/#{id}/deployments.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/deployments HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "id":107,
      "triggered_by":"test@cloud66.com",
      "triggered_via":
        {
          "code":0,
          "meaning":"web"
        },
      "started_at":"2014-08-29T17:46:16Z",
      "finished_at":"2014-08-29T17:58:23Z",
      "outcome":
        {
          "code":1,
          "meaning":"success"
        },
      "git_hash":"5675fcd8f9e6dc534ecf1410c0661c066097e310",
      "deploy_session":"OhBHNzkXSl",
      "deploy_type":
        {
          "code":0,
          "meaning":"build"
        },
      "is_head":true,
      "is_live":true,
      "reverted":null,
      "reverted_by":null,
      "reverted_at":null,
      "is_deploying":false,
      "commit_url":"https://github.com/cloud66-samples/rails-test/commit/5675fcd8f9e6dc534ecf1410c0661c066097e310"
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}

Get list of all deployments of a stack

HTTP Request

GET /stacks/{id}/deployments

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80

Deployment

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = '3608'
response = token.get("#{api_url}/stacks/#{stack_id}/deployments/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/deployments/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":107,
      "triggered_by":"test@cloud66.com",
      "triggered_via":
        {
          "code":0,
          "meaning":"web"
        },
      "started_at":"2014-08-29T17:46:16Z",
      "finished_at":"2014-08-29T17:58:23Z",
      "outcome":
        {
          "code":1,
          "meaning":"success"
        },
      "git_hash":"5675fcd8f9e6dc534ecf1410c0661c066097e310",
      "deploy_session":"OhBHNzkXSl",
      "deploy_type":
        {
          "code":0,
          "meaning":"build"
        },
      "is_head":true,
      "is_live":true,
      "reverted":null,
      "reverted_by":null,
      "reverted_at":null,
      "is_deploying":false,
      "commit_url":"https://github.com/cloud66-samples/rails-test/commit/5675fcd8f9e6dc534ecf1410c0661c066097e310"
    }
}

Get information of a single deployment

HTTP Request

GET /stacks/{stack_id}/deployments/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The deployment ID 107

Redeploy

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/deployments.json")

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/deployments HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "ok":true,
      "message":"Stack queued for redeployment"
    }
}

Redeploy a stack

HTTP Request

POST /stacks/{stack_id}/deployments

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
git_ref optional string Git reference (branch, tag or hash). Non-docker only. a_git_tag_or_hash
services_filter optional string Services from your stack to deploy only. Docker only. service1,service2

Cancel deployment

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = '3649'
response = token.delete("#{api_url}/stacks/#{stack_id}/deployments/#{id}.json")

puts JSON.parse(response.body)['response']
DELETE /stacks/{stack_id}/deployments/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "ok":true,
      "message":"Cancelling deployment"
    }
}

Cancel a live stack deployment

HTTP Request

DELETE /stacks/{stack_id}/deployments/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The deployment ID 112

Services

Services list

id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.get("#{api_url}/stacks/#{id}/services.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/services HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "name": "web",
      "containers": [
        {
          "uid": "1339d2dfa5a86dfce497f8f2e1bb29492f246288c722d11c8e6fc9348bfeece6",
          "server_uid": "edfbd7a9b97e999ebf17984282d4b457",
          "server_name": "Cormorant",
          "service_name": "web",
          "image": "quay.io/cloud66/sample-rails",
          "port_list": "[\"5128:3000\"]",
          "command": "rackup -p 3000",
          "started_at": "2014-09-30T09:59:45Z",
          "web_ports": "80:443",
          "created_at": "2014-09-30T09:59:45Z",
          "updated_at": "2014-09-30T09:59:48Z"
        }
      ]
    }
  ],
  "count": 1,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 1,
    "pages": 1
  }
}

Get a list of all services of the stack

HTTP Request

GET /stacks/{id}/services

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
server_uid optional string Server UID 1239b763474b0eafa5fafb64bff0ba80

Service show

stack_id = 'ec28beaa0e324c21ab2f9c5a153189a2'
id = 'web'
response = token.get("#{api_url}/stacks/#{stack_id}/services/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/services/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "name": "web",
    "containers": [
      {
        "uid": "1339d233a5a86dfce497f8f2e1bb29492f246288c722d11c8e6fc9348bfeece6",
        "server_uid": "1239b763474b0eafa5fafb64bff0ba80",
        "server_name": "Cormorant",
        "service_name": "web",
        "image": "quay.io/cloud66/sample-rails",
        "port_list": "[\"5128:3000\"]",
        "command": "rackup -p 3000",
        "started_at": "2014-09-30T09:59:45Z",
        "web_ports": "80:443",
        "created_at": "2014-09-30T09:59:45Z",
        "updated_at": "2014-09-30T09:59:48Z"
      }
    ]
  }
}

Get information of a service of the stack

HTTP Request

GET /stacks/{stack_id}/services/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string The service name web
server_uid optional string Server UID 1239b763474b0eafa5fafb64bff0ba80

Service scale

stack_id = 'ec28beaa0e324c21ab2f9c5a153189a2'
id = 'web'
response = token.post("#{api_url}/stacks/#{stack_id}/services.json", {body: {:service_name => id}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/services HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 1234,
    "user": "theuser@yourdomain.com",
    "resource_type": "stack",
    "action": "service_scale",
    "resource_id": "15633",
    "started_via": "api",
    "started_at": "2014-09-30T11:36:58Z",
    "finished_at": null,
    "finished_success": null,
    "finished_message": null
  }
}

Scale the given service over the stack

HTTP Request

POST /stacks/{stack_id}/services

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
service_name required string The service name web
server_count optional string A hash of server uid to count of containers desired on that server {"123123cfcb7d3d2b54614b19e2a6c673":2}
server_group_count optional string A hash of server_group to count of containers across the servers of that group {"web":4}

Service stop

stack_id = 'ec28beaa0e324c21ab2f9c5a153189a2'
id = 'web'
response = token.delete("#{api_url}/stacks/#{stack_id}/services/#{id}.json")

puts JSON.parse(response.body)['response']
DELETE /stacks/{stack_id}/services/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 1234,
    "user": "theuser@yourdomain.com",
    "resource_type": "stack",
    "action": "service_stop",
    "resource_id": "15633",
    "started_via": "api",
    "started_at": "2014-09-30T11:36:58Z",
    "finished_at": null,
    "finished_success": null,
    "finished_message": null
  }
}

Stop all of the given service on the stack (across all servers, unless server_uid is supplied)

HTTP Request

DELETE /stacks/{stack_id}/services/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string The service name web
server_uid optional string Server UID 1239b763474b0eafa5fafb64bff0ba80

Containers

Containers list

id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.get("#{api_url}/stacks/#{id}/containers.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/containers HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
   "response":[
      {
         "uid":"cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc",
         "server_uid":"c6014897b8c8e9f2fc204a3a9efdae05",
         "server_name":"Gazelle",
         "service_name":"web",
         "image":"quay.io/cloud66/sample-rails",
         "command":"bundle exec rackup -p 3000",
         "started_at":"2015-02-10T17:41:31Z",
         "ports":[
            {
               "container":3000,
               "http":80,
               "https":443
            }
         ],
         "private_ip":"25.0.0.2",
         "docker_ip":null,
         "health_state":1,
         "health_message":null,
         "health_source":"system",
         "capture_output":true,
         "restart_on_deploy":true,
         "created_at":"2015-02-10T17:41:37Z",
         "updated_at":"2015-02-17T14:40:17Z"
      }
   ],
   "count":1,
   "pagination":{
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
   }
}

Get a list of all the containers of the stack

HTTP Request

GET /stacks/{id}/containers

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
server_uid optional string Server UID c6014897b8c8e9f2fc204a3a9efdae05

Container show

stack_id = 'ec28beaa0e324c21ab2f9c5a153189a2'
id = 'cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc'
response = token.get("#{api_url}/stacks/#{stack_id}/containers/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/containers/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
   "response":{
      "uid":"cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc",
      "server_uid":"c6014897b8c8e9f2fc204a3a9efdae05",
      "server_name":"Gazelle",
      "service_name":"web",
      "image":"quay.io/cloud66/sample-rails",
      "command":"bundle exec rackup -p 3000",
      "started_at":"2015-02-10T17:41:31Z",
      "ports":[
         {
            "container":3000,
            "http":80,
            "https":443
         }
      ],
      "private_ip":"25.0.0.2",
      "docker_ip":"172.0.2.12",
      "health_state":1,
      "health_message":null,
      "health_source":"system",
      "capture_output":true,
      "restart_on_deploy":true,
      "created_at":"2015-02-10T17:41:37Z",
      "updated_at":"2015-02-17T14:40:17Z",
      "runtime":{
         "AppArmorProfile":"",
         "Args":[
            "bundle",
            "exec",
            "rackup",
            "-p",
            "3000"
         ],
         "Config":{
            "AttachStderr":true,
            "AttachStdin":false,
            "AttachStdout":true,
            "Cmd":[
               "bundle",
               "exec",
               "rackup",
               "-p",
               "3000"
            ],
            "CpuShares":0,
            "Cpuset":"",
            "Domainname":"",
            "Entrypoint":[
               "/etc/cloud66/tools/docker_network.sh"
            ],
            "Env":[
               "STACK_GIT_BRANCH=",
               "STACK_PATH=/var/deploy/lv_dev_service_download/web_head/current",
               "STACK_BASE=/var/deploy/lv_dev_service_download/web_head",
               "SECRET_KEY_BASE=f30c0e5da0cb4467e4cae0f315a664d023b1782f791e682dbe2dc100d3b010cd6b3d899c01138470c10892cf31732b7bb83a31b4907296ad985e8f55663629c1",
               "WEB_ADDRESS_INT=10.132.130.135",
               "WEB_ADDRESS_EXT=104.236.242.128",
               "WEB_ADDRESSES_INT=10.132.130.135",
               "WEB_ADDRESSES_EXT=104.236.242.128",
               "MYSQL_USERNAME=uacru9",
               "MYSQL_PASSWORD=FBfgULSTlfjruP3",
               "MYSQL_DATABASE=lv_dev_service_download_production",
               "MYSQL_ADDRESS_INT=10.132.130.135",
               "MYSQL_ADDRESS_EXT=104.236.242.128",
               "MYSQL_URL_INT=mysql://uacru9:FBfgULSTlfjruP3@10.132.130.135:3306/lv_dev_service_download_production",
               "MYSQL_URL_EXT=mysql://uacru9:FBfgULSTlfjruP3@104.236.242.128:3306/lv_dev_service_download_production",
               "MYSQL_SLAVE_ADDRESSES_INT=",
               "MYSQL_SLAVE_ADDRESSES_EXT=",
               "WEB_ADDRESS=10.132.130.135",
               "WEB_ADDRESSES=10.132.130.135",
               "MYSQL_ADDRESS=10.132.130.135",
               "MYSQL_URL=mysql://uacru9:FBfgULSTlfjruP3@10.132.130.135:3306/lv_dev_service_download_production",
               "MYSQL_SLAVE_ADDRESSES=",
               "SERVER_NAME=Gazelle",
               "PRIMARY=true",
               "CONTAINER_NOTIFY_URL=http://vic.local.cldblx.com/stacks/87bc318604208618a01817bf4442befb/servers/c6014897b8c8e9f2fc204a3a9efdae05/services/web/notification/4911055bcf0b5d7a31ebfbdff4043c31",
               "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
               "RUBY_MAJOR=2.1",
               "RUBY_VERSION=2.1.3"
            ],
            "ExposedPorts":{
               "3000/tcp":{

               }
            },
            "Hostname":"cba44fa6b6ac",
            "Image":"quay.io/cloud66/sample-rails",
            "MacAddress":"",
            "Memory":0,
            "MemorySwap":0,
            "NetworkDisabled":false,
            "OnBuild":null,
            "OpenStdin":false,
            "PortSpecs":null,
            "StdinOnce":false,
            "Tty":false,
            "User":"",
            "Volumes":null,
            "WorkingDir":"/usr/src/app"
         },
         "Created":"2015-02-10T17:41:36.988310784Z",
         "Driver":"aufs",
         "ExecDriver":"native-0.2",
         "HostConfig":{
            "Binds":[
               "/etc/cloud66/tools:/etc/cloud66/tools",
               "/var/log/containers:/usr/src/app/log",
               "/tmp:/tmp_host:rw"
            ],
            "CapAdd":null,
            "CapDrop":null,
            "ContainerIDFile":"",
            "Devices":[

            ],
            "Dns":[
               "172.17.42.1"
            ],
            "DnsSearch":null,
            "ExtraHosts":null,
            "IpcMode":"",
            "Links":null,
            "LxcConf":[

            ],
            "NetworkMode":"bridge",
            "PortBindings":{

            },
            "Privileged":false,
            "PublishAllPorts":false,
            "RestartPolicy":{
               "MaximumRetryCount":0,
               "Name":""
            },
            "SecurityOpt":null,
            "VolumesFrom":null
         },
         "HostnamePath":"/var/lib/docker/containers/cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc/hostname",
         "HostsPath":"/var/lib/docker/containers/cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc/hosts",
         "Id":"cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc",
         "Image":"f3443abc9c9e1595d1e039bf0c060f259d318e57910a80efee2e34895b10e749",
         "MountLabel":"",
         "Name":"/stoic_nobel",
         "NetworkSettings":{
            "Bridge":"docker0",
            "Gateway":"172.17.42.1",
            "IPAddress":"172.17.0.4",
            "IPPrefixLen":16,
            "MacAddress":"02:42:ac:11:00:04",
            "PortMapping":null,
            "Ports":{
               "3000/tcp":null
            }
         },
         "Path":"/etc/cloud66/tools/docker_network.sh",
         "ProcessLabel":"",
         "ResolvConfPath":"/var/lib/docker/containers/cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc/resolv.conf",
         "State":{
            "Error":"",
            "ExitCode":0,
            "FinishedAt":"0001-01-01T00:00:00Z",
            "OOMKilled":false,
            "Paused":false,
            "Pid":25739,
            "Restarting":false,
            "Running":true,
            "StartedAt":"2015-02-10T17:41:37.915288589Z"
         },
         "Volumes":{
            "/etc/cloud66/tools":"/etc/cloud66/tools",
            "/tmp_host":"/tmp",
            "/usr/src/app/log":"/var/log/containers"
         },
         "VolumesRW":{
            "/etc/cloud66/tools":true,
            "/tmp_host":true,
            "/usr/src/app/log":true
         }
      }
   }
}

Get information of a container of the stack (includes container runtime information)

HTTP Request

GET /stacks/{stack_id}/containers/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string The container UID cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc

Container stop

stack_id = 'ec28beaa0e324c21ab2f9c5a153189a2'
id = 'cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc'
response = token.delete("#{api_url}/stacks/#{stack_id}/containers/#{id}.json")

puts JSON.parse(response.body)['response']
DELETE /stacks/{stack_id}/containers/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 1234,
    "user": "theuser@yourdomain.com",
    "resource_type": "stack",
    "action": "container_stop",
    "resource_id": "15633",
    "started_via": "api",
    "started_at": "2014-09-30T11:36:58Z",
    "finished_at": null,
    "finished_success": null,
    "finished_message": null
  }
}

Stop the given container

HTTP Request

DELETE /stacks/{stack_id}/containers/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string The container UID cba44fa6b6acf57fb0ef6c2ce385f6a129867df544dae7181d2410e9f9cc32bc

Docker Image Repositories

Docker Image Repository list

response = token.get("#{api_url}/image_repositories.json")

puts JSON.parse(response.body)['response']
GET /image_repositories HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "id": 2,
      "url": "https://quay.io",
      "username": "cloud66",
      "email": "kickass@company.com",
      "created_at_iso": "2015-12-03T14:29:51Z",
      "updated_at_iso": "2015-12-03T14:29:51Z"
    },
    {
      "id": 3,
      "url": "https://index.dockerub.com",
      "username": "cloud66",
      "email": "eng@company.com",
      "created_at_iso": "2015-12-03T14:30:17Z",
      "updated_at_iso": "2015-12-03T14:30:17Z"
    }
  ],
  "count": 2,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 2,
    "pages": 1
  }
}

Get list of all Docker image repositories for an account

HTTP Request

GET /image_repositories

Docker Image Repository

id = 3
response = token.get("#{api_url}/image_repositories/#{id}.json")

puts JSON.parse(response.body)['response']
GET /image_repositories/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 3,
    "url": "https://index.dockerub.com",
    "username": "cloud66",
    "email": "eng@company.com",
    "created_at_iso": "2015-12-03T14:30:17Z",
    "updated_at_iso": "2015-12-03T14:30:17Z"
  }
}

Get information of a single Docker image repository

HTTP Request

GET /image_repositories/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The Docker image repository ID 3

Add Docker Image Repository

response = token.post("#{api_url}/image_repositories.json", {body: {:url => 'https://quay.io', :email => 'kickass@company.com', :username => 'Kickass', :password => 'supersecret'}})

puts JSON.parse(response.body)['response']
POST /image_repositories HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 283,
    "url": "https://quay.io",
    "username": "Kickass",
    "email": "kickass@company.com",
    "created_at_iso": "2015-12-03T14:30:17Z",
    "updated_at_iso": "2015-12-03T14:30:17Z"
  }
}

HTTP Request

POST /image_repositories

Query parameters

Parameter Presence Data type Description Sample value
url required string Repository URL https://quay.io
email required string User email address kickass@company.com
username required string Username Kickass
password required string Password supersecret

Edit Docker Image Repository

id = 283
response = token.put("#{api_url}/image_repositories/#{id}.json", {body: {:url => 'https://quay.io', :email => 'kickass_squared@company.com', :username => 'KickassSquared', :password => 'supersecret'}})

puts JSON.parse(response.body)['response']
PUT /image_repositories/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 283,
    "url": "https://quay.io",
    "username": "KickassSquared",
    "email": "kickass_squared@company.com",
    "created_at_iso": "2015-12-03T14:30:17Z",
    "updated_at_iso": "2015-12-03T14:30:17Z"
  }
}

HTTP Request

PUT /image_repositories/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The Docker image repository ID 283
url required string Repository URL https://quay.io
email required string User email address kickass_squared@company.com
username required string Username KickassSquared
password required string Password supersecret

Delete Docker Image Repository

id = 283
response = token.delete("#{api_url}/image_repositories/#{id}.json")

puts JSON.parse(response.body)['response']
DELETE /image_repositories/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "ok": true
  }
}

HTTP Request

DELETE /image_repositories/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The Docker image repository ID 283

Environment Variables

Environment Variable list

id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/#{id}/environments.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/environments HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "id": 4152,
      "key": "STACK_GIT_BRANCH",
      "value": "master",
      "readonly": true,
      "created_at": "2014-08-29T17:21:25Z",
      "updated_at": "2014-08-29T17:21:25Z",
      "is_password":false,
      "is_generated": true,
              "history" : [{ "key" : 1, "value" : "develop", "created_at" : "2015-05-08T15:09:50Z", "updated_at" : "2015-05-08T15:09:50Z" }]
    },
    {
      "id": 4153,
      "key": "STACK_PATH",
      "value": "/var/deploy/test-elastic-1/web_head/current",
      "readonly": true,
      "created_at": "2014-08-29T17:21:25Z",
      "updated_at": "2014-08-29T17:21:25Z",
      "is_password": false,
      "is_generated": true,
              "history" : [{ "key" : 2, "value" : "/var/deploy/test-elastic-1/web_head/somethingold", "created_at" : "2015-05-08T14:01:50Z", "updated_at" : "2015-05-08T14:01:50Z" }]                    
    },
    {
      "id": 4167,
      "key": "POSTGRESQL_USERNAME",
      "value": "tja",
      "readonly": false,
      "created_at": "2014-08-29T17:21:26Z",
      "updated_at":"2014-08-29T17:21:26Z",
      "is_password":false,
      "is_generated":true,
              "history" : [{ "key" : 5, "value" : "xyz", "created_at" : "2015-05-08T14:01:50Z", "updated_at" : "2015-05-08T14:01:50Z" }, { "key" : 6, "value" : "123", "created_at" : "2015-05-08T14:02:50Z", "updated_at" : "2015-05-08T14:02:50Z" }]
    },
    {
      "id":4168,
      "key": "POSTGRESQL_PASSWORD",
      "value": "tjena",
      "readonly":false,
      "created_at":"2014-08-29T17:21:26Z",
      "updated_at":"2014-08-29T17:21:26Z",
      "is_password":true,
      "is_generated":true,
              "history" : []
    }
  ],
  "count":30,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":4,
      "pages":1
    }
}

Get list of all environment variables of stack

HTTP Request

GET /stacks/{id}/environments

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80

Environment Variable

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 4153
response = token.get("#{api_url}/stacks/#{stack_id}/environments/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/environments/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id": 4153,
      "key":
      "STACK_PATH",
      "value":"/var/deploy/test-elastic-1/web_head/current",
      "readonly":true,
      "created_at":"2014-08-29T17:21:25Z",
      "updated_at":"2014-08-29T17:21:25Z",
      "is_password":false,
      "is_generated":true,
                "history" : [{ "key" : 5, "value" : "xyz", "created_at" : "2015-05-08T14:01:50Z", "updated_at" : "2015-05-08T14:01:50Z" }, { "key" : 6, "value" : "123", "created_at" : "2015-05-08T14:02:50Z", "updated_at" : "2015-05-08T14:02:50Z" }]
    }
}

Get information of a single environment variable

HTTP Request

GET /stacks/{stack_id}/environments/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The environment variable ID 4153

Add Environment Variable

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/environments.json", {body: {:key => 'MY_ENVIRONMENT_VALUE', :value => 'SOME_VALUE'}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/environments HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":5,
      "user":"test@cloud66.com",
      "resource_type": "stack",
      "action": "env-var-new",
      "resource_id": "280",
      "started_via":"api",
      "started_at": "2014-09-01T10:56:57Z",
      "finished_at": null,
      "finished_success":null,
      "finished_message":null
    }
}

Add a new environment variable

HTTP Request

POST /stacks/{stack_id}/environments

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
key required string The new environment variable key MY_ENVIRONMENT_VALUE
value required string The new environment variable new value SOME_VALUE

Update Environment Variable

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
key = 'POSTGRESQL_SLAVE_ADDRESSES'
response = token.put("#{api_url}/stacks/#{stack_id}/environments/#{key}.json", {body: {:value => '127.0.0.1'}})

puts JSON.parse(response.body)['response']
PUT /stacks/{stack_id}/environments/{key} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":3,
      "user": "test@cloud66.com",
      "resource_type": "stack",
      "action": "env-var-update",
      "resource_id":"280",
      "started_via":"api",
      "started_at": "2014-09-01T10:44:52Z",
      "finished_at": null,
      "finished_success":null,
      "finished_message":null
    }
}

Update value of an environment variable if it is not readonly

HTTP Request

PUT /stacks/{stack_id}/environments/{key}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
key required string The environment variable key POSTGRESQL_SLAVE_ADDRESSES
value required string The environment variable new value 127.0.0.1

Delete Environment Variable

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
key = 'MY_ENV_1'
response = token.delete("#{api_url}/stacks/#{stack_id}/environments/#{key}.json)

puts JSON.parse(response.body)['response']
DELETE /stacks/{stack_id}/environments/{key} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

Delete an environment variable if it is not readonly or generated by cloud66

HTTP Request

DELETE /stacks/{stack_id}/environments/{key}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
key required string The environment variable key MY_ENV_1

Firewall rules

Firewall rules list

id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{id}/firewalls.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/firewalls HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "id": 5027,
      "from_ip": "0.0.0.0/0",
      "from_group_id": null,
      "from_server_id": null,
      "to_ip": null,
      "to_group_id": 128,
      "to_server_id": null,
      "protocol": "tcp",
      "port": 80,
      "rule_type": "dynamic",
      "comments":null,
      "created_at": "2014-08-29T17:58:23Z",
      "updated_at": "2014-08-29T17:58:23Z"
    },
    {
      "id":5028,
      "from_ip":"0.0.0.0/0",
      "from_group_id":null,
      "from_server_id":null,
      "to_ip":null,
      "to_group_id":128,
      "to_server_id":null,
      "protocol":"tcp",
      "port":443,"rule_type":
      "dynamic",
      "comments":null,
      "created_at":
      "2014-08-29T17:58:23Z",
      "updated_at":"2014-08-29T17:58:23Z"
    }
  ],
  "count":2,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":11,
      "pages":1
    }
}

Get list of all firewall rules of stack

HTTP Request

GET /stacks/{id}/firewalls

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80

Firewall rule

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 4153
response = token.get("#{api_url}/stacks/#{stack_id}/firewalls/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/firewalls/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":5027,
      "from_ip":"0.0.0.0/0",
      "from_group_id":null,
      "from_server_id":null,
      "to_ip":null,
      "to_group_id":128,
      "to_server_id":null,
      "protocol":"tcp",
      "port":80,
      "rule_type":"dynamic",
      "comments":null,
      "created_at":"2014-08-29T17:58:23Z",
      "updated_at":"2014-08-29T17:58:23Z"
    }
}

Get information of a single firewall rule

HTTP Request

GET /stacks/{stack_id}/firewalls/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The firewall rule ID 4153

Add Firewall rule

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/firewalls.json", {body: {:from_ip => '123.123.123.123', :protocol => 1, :port => 80, :ttl => 20}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/firewalls HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":1851,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"open_lease",
      "resource_id":"1268",
      "started_via":"api",
      "started_at":"2015-12-08T18:01:21Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

One of the from/to params must be specified. If you specify ttl , from_ip can be set as AUTO, then caller IP will be set as from_ip

HTTP Request

POST /stacks/{stack_id}/firewalls

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
ttl optional integer Time that firewall rule will be expires in 20
from_ip optional string From IP value of rule 123.123.123.123
from_group_id optional integer You can specify a server group ID as From 19
from_server_id optional integer You can specify a server ID as From 193
to_ip optional string To IP value of rule 123.123.123.123
to_group_id optional integer You can specify a server group ID as To 19
to_server_id optional integer You can specify a server ID as To 1
protocol required integer Protocol of firewall rule . 1=TCP , 2=UDP , 3=ICMP 1
port required integer Port of firewall rule 80

Notifications

Notifications list

id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{id}/notifications.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/notifications HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "id":1189,
      "user_id":18,
      "alert_type":"stack.provision.ok",
      "channels":["email"],
      "stack_id":"5acd43412ea412e32897c40d46f91183",
      "params":{},
      "created_at":"2014-05-29T17:29:54Z",
      "updated_at":"2014-05-29T17:29:54Z"
    },
    {
      "id":1190,
      "user_id":18,
      "alert_type":"stack.provision.fail",
      "channels":["email"],
      "stack_id":"5acd43412ea412e32897c40d46f91183",
      "params":{},
      "created_at":"2014-05-29T17:29:54Z",
      "updated_at":"2014-05-29T17:29:54Z"
    },
    {
      "id":1191,
      "user_id":18,
      "alert_type":"stack.redeploy.ok",
      "channels":["email"],
      "stack_id":"5acd43412ea412e32897c40d46f91183",
      "params":{},
      "created_at":"2014-05-29T17:29:54Z",
      "updated_at":"2014-05-29T17:29:54Z"
    }
  ],
  "count":30,
  "pagination":
    {
      "previous":null,
      "next":2,
      "current":1,
      "per_page":30,
      "count":48,
      "pages":2
    }
}

Get list of all environment variables of stack

HTTP Request

GET /stacks/{id}/notifications

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
alert_type optional string Type of alert server.stopped

Notification

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 1191
response = token.get("#{api_url}/stacks/#{stack_id}/notifications/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/notifications/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":1191,
      "user_id":18,
      "alert_type":
      "stack.redeploy.ok",
      "channels":["email"],
      "stack_id":"5acd43412ea412e32897c40d46f91183",
      "params":{},
      "created_at":"2014-05-29T17:29:54Z",
      "updated_at":"2014-05-29T17:29:54Z"
    }
}

Get information of a single notification

HTTP Request

GET /stacks/{stack_id}/notifications/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The notification ID 1191

Update Notification

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 1191

channels = ['email','hipchat']
params = {:hipchat_room => 'test', :hipchat_token => 'YOUR_TOKEN'}

response = token.put("#{api_url}/stacks/#{stack_id}/notifications/#{id}.json", {body: {:channels => channels, :params => params}})

puts JSON.parse(response.body)['response']
PUT /stacks/{stack_id}/notifications/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
  {
    "id":85,
    "user_id":1,
    "alert_type":"active.protect.block",
    "channels":["email","hipchat"],
    "stack_id":"3ee97c150d95a9dc4fc801783d18087c",
    "params":{},
    "created_at":"2015-11-16T18:14:04Z",
    "updated_at":"2015-12-09T13:06:14Z"
  }
}

Update channels or params of a notification

HTTP Request

PUT /stacks/{stack_id}/notifications/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The notification ID 1191
channels optional string Notification channels (valid channels are: email, ios, hipchat, webhook, slack) [email,ios]
params optional string Notification channel parameters (as JSON string with valid keys: hipchat_token, hipchat_room, slack_url, slack_channel, webhook_url) {'hipchat_room' : 'test'}

Stack settings

Settings list

id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{id}/settings.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/settings HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "id":"allowed-web-source",
      "key":"allowed.web.source",
      "value":null,
      "readonly":false,
      "warning_text":""
    },
    {
      "id":"asset-prefix",
      "key":"asset.prefix",
      "value":"assets",
      "readonly":false,
      "warning_text":""
    },
    {
      "id":"git-branch",
      "key":"git.branch",
      "value":"master",
      "readonly":false,
      "warning_text":""
    },
    {
      "id":"reconfigure-nginx",
      "key":"reconfigure.nginx",
      "value":false,
      "readonly":false,
      "warning_text":""
    },
    {
      "id":"stack-name",
      "key":"stack.name",
      "value":"test-elastic-1",
      "readonly":true,
      "warning_text":"Warning! Changing this value will also modify your Cloud 66 *.c66.me DNS values"
    },
    {
      "id":"maintenance-mode",
      "key":"maintenance.mode",
      "value":false,
      "readonly":false,
      "warning_text":""

    }
  ],
  "count":5,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":6,
      "pages":1
    }
}

Get list of all settings of stack

HTTP Request

GET /stacks/{id}/settings

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80

Setting

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 'git-branch'
response = token.get("#{api_url}/stacks/#{stack_id}/settings/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/settings/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "key":"git.branch",
      "value":"master"
    }
}

Get information of a single setting item

HTTP Request

GET /stacks/{stack_id}/settings/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string The setting item ID git-branch

Update Setting

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 'git-branch'
response = token.put("#{api_url}/stacks/#{stack_id}/settings/#{id}.json", {body: {:value => 'staging'}})

puts JSON.parse(response.body)['response']
PUT /stacks/{stack_id}/settings/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":7,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"stack-set: git.branch",
      "resource_id":"280",
      "started_via":"api",
      "started_at":"2014-09-01T12:47:24Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

Update value of a setting item

HTTP Request

PUT /stacks/{stack_id}/settings/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The setting item ID git-branch
value required string The setting item new value staging

Jobs

Jobs list

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{stack_id}/jobs.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/jobs HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
   "response":[
     {
       "uid":"98ee5a9b93919d9b63bd5377636675bd",
       "name":"rake_test",
       "type":"RakeJob",
       "cron":null,
       "status":2,
       "params":{"task":"db:migrate"},
       "created_at":"2016-02-01 13:37:07 UTC",
       "updated_at":"2016-02-01 13:37:07 UTC"
      }
   ],
    "count":1,
    "pagination":
      {
        "previous":null,
        "next":null,
        "current":1,
        "per_page":30,
        "count":1,
        "pages":1
      }
}

Get list of all jobs of a stack.

HTTP Request

GET /stacks/{id}/jobs

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string stack UID 5999b763474b0eafa5fafb64bff0ba80

Run a job

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
id = 98ee5a9b93919d9b63bd5377636675bd
response = token.get("#{api_url}/stacks/#{stack_id}/jobs/{job_id}/run_now.json")

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/jobs/{job_id}/run_now HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":2593,
      "user":"test@example.com",
      "resource_type":"stack",
      "action":"job_run_now",
      "resource_id":"1602",
      "started_via":"api",
      "started_at":"2016-02-04T12:52:24Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

Run the job.

HTTP Request

POST /stacks/{stack_id}/jobs/{job_id}/run_now

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
job_id required string Job ID 98ee5a9b93919d9b63bd5377636675bd
job_args optional string Arguments passed to the command Arg1

Server Groups

Server Groups list

id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{id}/server_groups.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/server_groups HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "id": 128,
      "name": "Rails Server",
      "type": "rails",
      "created_at": "2014-08-29T17:21:47Z",
      "updated_at": "2014-08-29T17:21:47Z"
    },
    {
      "id":129,
      "name":
      "PostgreSQL Server",
      "type": "postgresql",
      "created_at": "2014-08-29T17:21:47Z",
      "updated_at":"2014-08-29T17:21:47Z"
    }
  ],
  "count": 2,
  "pagination":
    {
      "previous": null,
      "next": null,
      "current": 1,
      "per_page": 30,
      "count":2,
      "pages":1
    }
}

Get list of all server groups of stack

HTTP Request

GET /stacks/{id}/server_groups

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80

Server Group

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 128
response = token.get("#{api_url}/stacks/#{stack_id}/server_groups/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/server_groups/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{

  "response":
    {
      "id": 128,
      "name": "Rails Server",
      "type": "rails",
      "created_at": "2014-08-29T17:21:47Z",
      "updated_at": "2014-08-29T17:21:47Z"
    }
}

Get information of a single server group

HTTP Request

GET /stacks/{stack_id}/server_groups/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The setting group ID 128

Scale up

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
id = 53
response = token.post("#{api_url}/stacks/#{stack_id}/server_groups/#{id}.json",  {body: {:subtype => 'docker', :server_size => 't2.small'}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/server_groups/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
     {
       "id":8,
       "user":"shab@shab.com",
       "resource_type":"stack",
       "action":"scale_up",
       "resource_id":"28",
       "started_via":"api",
       "started_at":"2016-04-04T18:13:14Z",
       "finished_at":null,
       "finished_success":null,
       "finished_message":null
     }
}

Scale-up a new server in server group. subtype and server_size must be passed as params.

HTTP Request

POST /stacks/{stack_id}/server_groups/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer The server group id 12345
subtype required string The server group type ( valid options are web, process and docker ) docker
server_size required string The server size base on your cloud t2.small
server_count optional integer The number of server to scale-up 2
server_availability_zone optional string The availability zone which you want the servers fired into (AWS EC2 only) us-east-1d
server_subnet_id optional string The subnet_id which you want the servers fired into (AWS EC2 only) subnet-123456
root_disk_type optional string Disk type, accepted values are ssd and magnetic. (AWS EC2 and GCE only) ssd
root_disk_size optional integer Default size of root disk (in GB) for servers. (AWS EC2 and GCE only) 40
server_names optional string The name of the servers backend1,backend2

Servers

Servers list

id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{id}/servers.json")

puts JSON.parse(response.body)['response']
GET /stacks/{id}/servers HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "uid": "f8468fc145ea49bac474b30a8fea888d",
      "vendor_uid": "2492780",
      "name": "Caribou",
      "address": "146.185.133.183",
      "distro": "ubuntu",
      "distro_version": "14.04",
      "dns_record": "caribou.sb-elastic-1.dev.c66.me",
      "user_name": "root",
      "server_type": "Cloud (DigitalOcean) ",
      "server_roles": [
        "rails",
        "postgresql",
        "elasticsearch",
        "web",
        "app",
        "db"
      ],
      "server_group_id": 128,
      "stack_uid": "5acd43412ea412e32897c40d46f91183",
      "has_agent": true,
      "params":
        {
          "availability_zone": "2",
          "size": "63",
          "region": "2",
          "ips":["146.185.133.183"],
          "was_baselined": true,
          "cached_cores":1,
          "cached_memory": 1042336972,
          "passenger_version": "4.0.48",
          "passenger_enterprise": false,
          "supports_nginx_realip": true,
          "passenger_pool_max": 4
        },
      "created_at": "2014-08-29T17:21:47Z",
      "updated_at": "2014-08-29T17:54:41Z",
      "region":"2",
      "availability_zone": "2",
      "ext_ipv4": "146.185.133.183",
      "health_state": 3,
      "int_ipv4": "146.185.133.183",
      "int_ipv6": null,
      "ext_ipv6": null
    }
  ],
  "count":1,
  "pagination":
    {
      "previous": null,
      "next": null,
      "current": 1,
      "per_page": 30,
      "count": 1,
      "pages": 1
    }
}

Get list of all servers of stack

HTTP Request

GET /stacks/{id}/servers

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80

Servers

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
id = 'f8468fc145ea49bac474b30a8fea888d'
response = token.get("#{api_url}/stacks/#{stack_id}/servers/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/servers/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "uid": "f8468fc145ea49bac474b30a8fea888d",
      "vendor_uid": "2492780",
      "name": "Caribou",
      "address": "146.185.133.183",
      "distro": "ubuntu",
      "distro_version": "14.04",
      "dns_record": "caribou.sb-elastic-1.dev.c66.me",
      "user_name": "root",
      "server_type": "Cloud (DigitalOcean) ",
      "server_roles":[
        "rails",
        "postgresql",
        "elasticsearch",
        "web",
        "app",
        "db"
      ],
      "server_group_id": 128,
      "stack_uid": "5acd43412ea412e32897c40d46f91183",
      "has_agent": true,
      "params":
        {
          "availability_zone": "2",
          "size": "63",
          "region": "2",
          "ips":["146.185.133.183"],
          "was_baselined": true,
          "cached_cores": 1,
          "cached_memory": 1042336972,
          "passenger_version": "4.0.48",
          "passenger_enterprise": false,
          "supports_nginx_realip": true,
          "passenger_pool_max":4
        },
       "created_at": "2014-08-29T17:21:47Z",
       "updated_at": "2014-08-29T17:54:41Z",
       "region": "2",
       "availability_zone": "2",
       "ext_ipv4": "146.185.133.183",
       "health_state":3,
       "int_ipv4": "146.185.133.183",
       "int_ipv6": null,
       "ext_ipv6": null
    }
}

Get information of a single server

HTTP Request

GET /stacks/{stack_id}/servers/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required string The server ID f8468fc145ea49bac474b30a8fea888d
include_private_key optional integer if set to 1 then private_key will included in response 1

Reboot server

stack_id = 'a6b583684833a2cf4845079c9d9350a8'
response = token.post("#{api_url}/stacks/#{stack_id}/servers/#{server_id}/reboot_server"

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/servers/#{server_id}/reboot_server HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":10,
      "user":"test@cloud66.com",
      "resource_type":"stack",
      "action":"server_reboot",
      "resource_id":"283",
      "started_via":"api",
      "started_at":"2016-01-01T19:08:05Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

You can use this method to reboot a speific server of a stack.

HTTP Request

POST /stacks/{stack_id}/servers/#{server_id}/reboot_server

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string Unique identifier of the stack 5999b763474b0eafa5fafb64bff0ba80
server_id required string Unique identifier of the server f8468fc145ea49bac474b30a8fea888d

Server Settings settings

Server Settings list

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
server_id = 'f8468fc145ea49bac474b30a8fea888d'
response = token.get("#{api_url}/stacks/#{stack_id}/servers/#{server_id}/settings.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/servers/{server_id}/settings HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "key":"server.name",
      "value":"Caribou",
      "readonly":true,
      "warning_text":"Warning! Changing this value will also modify your Cloud 66 *.c66.me DNS values"}
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}

Get list of all settings of a server

HTTP Request

GET /stacks/{stack_id}/servers/{server_id}/settings

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
server_id required string The server UID f8468fc145ea49bac474b30a8fea888d

Server Setting

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
server_id = 'f8468fc145ea49bac474b30a8fea888d'
id = 'server-name'
response = token.get("#{api_url}/stacks/#{stack_id}/servers/#{server_id}/settings/#{id}.json")

puts JSON.parse(response.body)['response']
GET stacks/{stack_id}/servers/{server_id}/settings/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "key":"server.name",
      "value":"Caribou"
    }
}

Get information of a single server setting item

HTTP Request

GET stacks/{stack_id}/servers/{server_id}/settings/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
server_id required string The server uid f8468fc145ea49bac474b30a8fea888d
id required string The server setting item ID server-name

Update Server Setting

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
server_id = 'f8468fc145ea49bac474b30a8fea888d'
id = 'server-name'
response = token.put("#{api_url}/stacks/#{stack_id}/servers/#{server_id}/settings/#{id}.json", {body: {:value => 'newname'}})

puts JSON.parse(response.body)['response']
PUT /stacks/{stack_id}/servers/{server_id}/settings/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":9,
      "user":"test@cloud66.com",
      "resource_type":"server",
      "action":"server-set: server.name",
      "resource_id":"445",
      "started_via":"api",
      "started_at":"2014-09-01T13:07:35Z",
      "finished_at":null,
      "finished_success":null,
      "finished_message":null
    }
}

Update value of a server setting item

HTTP Request

PUT /stacks/{stack_id}/servers/{server_id}/settings/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
server_id required string The server UID f8468fc145ea49bac474b30a8fea888d
id required string The server setting item ID server-name
value required string The server setting item new value newname

Clouds

Cloud list

response = token.get("#{api_url}/clouds.json")

puts JSON.parse(response.body)['response']
GET /clouds HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
    "response":[
       {
          "name":"aws",
          "display_name":"AWS",
          "regions":[
             {
                "id":"us-east-1",
                "name":"US East (Northern Virginia)"
             },
             {
                "id":"us-east-2",
                "name":"US East (Ohio)"
             },
             {
                "id":"us-west-1",
                "name":"US West (Northern California)"
             },
             {
                "id":"us-west-2",
                "name":"US West (Oregon)"
             },
             {
                "id":"ca-central-1",
                "name":"Canada (Central)"
             },
             {
                "id":"sa-east-1",
                "name":"South America (Sao Paulo, Brazil)"
             },
             {
                "id":"eu-central-1",
                "name":"Europe (Frankfurt, Germany)"
             },
             {
                "id":"eu-west-1",
                "name":"Europe (Dublin, Ireland)"
             },
             {
                "id":"eu-west-2",
                "name":"Europe (London)"
             },
             {
                "id":"ap-southeast-1",
                "name":"Asia Pacific (Singapore)"
             },
             {
                "id":"ap-northeast-1",
                "name":"Asia Pacific (Tokyo)"
             },
             {
                "id":"ap-southeast-2",
                "name":"Asia Pacific (Sydney)"
             },
             {
                "id":"ap-south-1",
                "name":"Asia Pacific (Mumbai)"
             }
          ],
          "server_sizes":[
             {
                "id":"t1.micro",
                "name":"Micro instance (t1.micro)"
             },
             {
                "id":"t2.micro",
                "name":"General purpose (t2.micro)"
             },
             {
                "id":"t2.small",
                "name":"General purpose (t2.small)"
             },
             {
                "id":"t2.medium",
                "name":"General purpose (t2.medium)"
             },
             {
                "id":"m1.small",
                "name":"General purpose (m1.small)"
             },
             {
                "id":"m1.medium",
                "name":"General purpose (m1.medium)"
             },
             {
                "id":"m1.large",
                "name":"General purpose (m1.large)"
             },
             {
                "id":"m1.xlarge",
                "name":"General purpose (m1.xlarge)"
             },
             {
                "id":"m3.medium",
                "name":"General purpose (m3.medium)"
             },
             {
                "id":"m3.large",
                "name":"General purpose (m3.large)"
             },
             {
                "id":"m3.xlarge",
                "name":"General purpose (m3.xlarge)"
             },
             {
                "id":"m3.2xlarge ",
                "name":"General purpose (m3.2xlarge )"
             },
             {
                "id":"c1.medium",
                "name":"Compute optimized (c1.medium)"
             },
             {
                "id":"c1.xlarge",
                "name":"Compute optimized (c1.xlarge)"
             },
             {
                "id":"c3.large",
                "name":"Compute optimized (c3.large)"
             },
             {
                "id":"c3.xlarge",
                "name":"Compute optimized (c3.xlarge)"
             },
             {
                "id":"c3.2xlarge",
                "name":"Compute optimized (c3.2xlarge)"
             },
             {
                "id":"c3.4xlarge",
                "name":"Compute optimized (c3.4xlarge)"
             },
             {
                "id":"c3.8xlarge",
                "name":"Compute optimized (c3.8xlarge)"
             },
             {
                "id":"cc2.8xlarge",
                "name":"Compute optimized (cc2.8xlarge)"
             },
             {
                "id":"m2.xlarge",
                "name":"Memory optimized (m2.xlarge)"
             },
             {
                "id":"m2.2xlarge",
                "name":"Memory optimized (m2.2xlarge)"
             },
             {
                "id":"m2.4xlarge",
                "name":"Memory optimized (m2.4xlarge)"
             },
             {
                "id":"cr1.8xlarge",
                "name":"Memory optimized (cr1.8xlarge)"
             },
             {
                "id":"hi1.4xlarge",
                "name":"Storage optimized (hi1.4xlarge)"
             },
             {
                "id":"hs1.8xlarge",
                "name":"Storage optimized (hs1.8xlarge)"
             },
             {
                "id":"cg1.4xlarge",
                "name":"GPU instances (cg1.4xlarge)"
             },
             {
                "id":"g2.2xlarge",
                "name":"GPU instances (g2.2xlarge)"
             },
             {
                "id":"i2.xlarge",
                "name":"Storage optimized (i2.xlarge)"
             },
             {
                "id":"i2.2xlarge",
                "name":"Storage optimized (i2.2xlarge)"
             },
             {
                "id":"i2.4xlarge",
                "name":"Storage optimized (i2.4xlarge)"
             },
             {
                "id":"i2.8xlarge",
                "name":"Storage optimized (i2.8xlarge)"
             },
             {
                "id":"r3.large",
                "name":"Memory optimized (r3.large)"
             },
             {
                "id":"r3.xlarge",
                "name":"Memory optimized (r3.xlarge)"
             },
             {
                "id":"r3.2xlarge",
                "name":"Memory optimized (r3.2xlarge)"
             },
             {
                "id":"r3.4xlarge",
                "name":"Memory optimized (r3.4xlarge)"
             },
             {
                "id":"r3.8xlarge",
                "name":"Memory optimized (r3.8xlarge)"
             }
          ]
       },
       {
          "name":"digitalocean",
          "display_name":"DigitalOcean",
          "regions":[
             {
                "id":"ams1",
                "name":"Amsterdam, Netherlands",
                "old_id":"2"
             },
             {
                "id":"ams2",
                "name":"Amsterdam 2, Netherlands",
                "old_id":"5"
             },
             {
                "id":"ams3",
                "name":"Amsterdam 3, Netherlands",
                "old_id":"9"
             },
             {
                "id":"nyc1",
                "name":"New York, US",
                "old_id":"1"
             },
             {
                "id":"nyc2",
                "name":"New York 2, US",
                "old_id":"4"
             },
             {
                "id":"nyc3",
                "name":"New York 3, US",
                "old_id":"8"
             },
             {
                "id":"sfo1",
                "name":"San Francisco, US",
                "old_id":"3"
             },
             {
                "id":"sgp1",
                "name":"Singapore",
                "old_id":"6"
             },
             {
                "id":"lon1",
                "name":"London, UK",
                "old_id":"7"
             }
          ],
          "server_sizes":[
             {
                "id":"512mb",
                "name":"512MB - 1 CPU"
             },
             {
                "id":"1gb",
                "name":"1GB - 1 CPU"
             },
             {
                "id":"2gb",
                "name":"2GB - 2 CPU"
             },
             {
                "id":"4gb",
                "name":"4GB - 2 CPU"
             },
             {
                "id":"8gb",
                "name":"8GB - 4 CPU"
             },
             {
                "id":"16gb",
                "name":"16GB - 8 CPU"
             },
             {
                "id":"32gb",
                "name":"32GB - 12 CPU"
             },
             {
                "id":"48gb",
                "name":"48GB - 16 CPU"
             },
             {
                "id":"64gb",
                "name":"64GB - 20 CPU"
             }
          ]
       }
    ],
    "count":2,
    "pagination":{
       "previous":null,
       "next":null,
       "current":1,
       "per_page":30,
       "count":2,
       "pages":1
    }
}

Get list of all clouds of account

HTTP Request

GET /clouds

Cloud

cloud_id = 'digitalocean'
response = token.get("#{api_url}/clouds/#{cloud_id}.json")

puts JSON.parse(response.body)['response']
GET /clouds/{cloud_id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
     {
        "name":"digitalocean",
        "display_name":"DigitalOcean",
        "regions":[
           {
              "id":"ams1",
              "name":"Amsterdam, Netherlands",
              "old_id":"2"
           },
           {
              "id":"ams2",
              "name":"Amsterdam 2, Netherlands",
              "old_id":"5"
           },
           {
              "id":"ams3",
              "name":"Amsterdam 3, Netherlands",
              "old_id":"9"
           },
           {
              "id":"nyc1",
              "name":"New York, US",
              "old_id":"1"
           },
           {
              "id":"nyc2",
              "name":"New York 2, US",
              "old_id":"4"
           },
           {
              "id":"nyc3",
              "name":"New York 3, US",
              "old_id":"8"
           },
           {
              "id":"sfo1",
              "name":"San Francisco, US",
              "old_id":"3"
           },
           {
              "id":"sgp1",
              "name":"Singapore",
              "old_id":"6"
           },
           {
              "id":"lon1",
              "name":"London, UK",
              "old_id":"7"
           }
        ],
        "server_sizes":[
           {
              "id":"512mb",
              "name":"512MB - 1 CPU"
           },
           {
              "id":"1gb",
              "name":"1GB - 1 CPU"
           },
           {
              "id":"2gb",
              "name":"2GB - 2 CPU"
           },
           {
              "id":"4gb",
              "name":"4GB - 2 CPU"
           },
           {
              "id":"8gb",
              "name":"8GB - 4 CPU"
           },
           {
              "id":"16gb",
              "name":"16GB - 8 CPU"
           },
           {
              "id":"32gb",
              "name":"32GB - 12 CPU"
           },
           {
              "id":"48gb",
              "name":"48GB - 16 CPU"
           },
           {
              "id":"64gb",
              "name":"64GB - 20 CPU"
           }
        ]
     }
}

Get information about a single cloud of an account

HTTP Request

GET /clouds/{cloud_id}

Query parameters

Parameter Presence Data type Description Sample value
cloud_id required string The cloud ID (name) digitalocean

Backups

Backups list

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.get("#{api_url}/stacks/#{stack_id}/backups.json", {body: {:db_type => 'mysql'}})

puts JSON.parse(response.body)['response']
GET /stacks/{id}/backups HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "id":4,
      "server_uid":"e63e859d5ab72b0bcf14321f0ffb013d",
      "db_type":"mysql",
      "database_name":"test-db",
      "file_base":"",
      "backup_date_iso":"2014-09-01T19:00:33Z",
      "backup_status":0,
      "backup_result":"",
      "restore_status":0,
      "restore_result":null,
      "created_at_iso":"2014-09-01T19:00:33Z",
      "updated_at_iso":"2014-09-01T19:00:33Z",
      "verify_status":0,
      "verify_result":null,
      "storage_path":"2aad2bb5a70e621ecf251fbd85af6927/backups/3c656a1bcc160769762763c6276c18b9/mysql/test_db_11/2014.09.01.19.00.31",
      "skip_tables":"","backup_size":0
    },
    {
      "id":1,
      "server_uid":"e63e859d5ab72b0bcf14321f0ffb013d",
      "db_type":"mysql",
      "database_name":"test-db",
      "file_base":"",
      "backup_date_iso":"2014-09-01T18:16:16Z",
      "backup_status":0,
      "backup_result":"",
      "restore_status":0,
      "restore_result":null,
      "created_at_iso":"2014-09-01T18:16:16Z",
      "updated_at_iso":"2014-09-01T18:16:16Z",
      "verify_status":0,
      "verify_result":null,
      "storage_path":"2aad2bb5a70e621ecf251fbd85af6927/backups/3c656a1bcc160769762763c6276c18b9/mysql/test_db_11/2014.09.01.18.16.14",
      "skip_tables":"","backup_size":0
    }
  ],
  "count":2,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":2,
      "pages":1
    }
}

Get list of all backups of stack.

HTTP Request

GET /stacks/{id}/backups

Query parameters

Parameter Presence Data type Description Sample value
id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
group optional integer Backup group ID 15
db_type optional string Backup database type (valid options are: mysql, postgresql, redis, mongodb) mysql

Backup

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
id = 4153
response = token.get("#{api_url}/stacks/#{stack_id}/backups/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/backups/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "id":1,
      "server_uid":"e63e859d5ab72b0bcf14321f0ffb013d",
      "db_type":"mysql",
      "database_name":"shab-test-db",
      "file_base":"",
      "backup_date_iso":"2014-09-01T18:16:16Z",
      "backup_status":0,
      "backup_result":"",
      "restore_status":0,
      "restore_result":null,
      "created_at_iso":"2014-09-01T18:16:16Z",
      "updated_at_iso":"2014-09-01T18:16:16Z",
      "verify_status":0,
      "verify_result":null,
      "storage_path":"2aad2bb5a70e621ecf251fbd85af6927/backups/3c656a1bcc160769762763c6276c18b9/mysql/test_db_11/2014.09.01.18.16.14",
      "skip_tables":"",
      "backup_size":0
    }
}

Get information about a single backup.

HTTP Request

GET /stacks/{stack_id}/backups/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
id required integer Backup ID 4153

New Backup

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
response = token.post("#{api_url}/stacks/#{stack_id}/backups.json", {body: {:db_type => 'mysql', :keep_count => 10}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/backups HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "ok":true,
      "message":"queued for creation"
    }
}

Create a new backup task.

HTTP Request

POST /stacks/{stack_id}/backups

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
db_type optional string Comma separated list of Database types which need backup tasks (valid options: all, mysql, postgresql, redis, mongodb) mysql,redis
frequency optional string Frequency of backup task in cron schedule format 0 */1 * * *
keep_count optional integer Number of previous backups to keep 10
gzip optional boolean Compress your backups with gzip. false
excluded_tables optional string Tables that must be excluded from the backup my_log_table
run_on_replica_server optional boolean Run backup task on replica server if available false

Import Backup

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
remote_url = 'https://s3.amazonaws.com/c66-managed-backup-non-prod/2aad2bb5a70e621ecf251fbd85af6927/backups/09a7dec0efdaa19b44148fccbf6128ec/redis/redis_23/2014.07.01.07.00.46/redis_23.tar'
response = token.post("#{api_url}/stacks/#{stack_id}/backups.json", {body: {:db_type => 'mysql', :group => 5, :remote_url => remote_url}})

puts JSON.parse(response.body)['response']
POST /stacks/{stack_id}/backups HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "ok":true,
      "message":"Your external backup queued for upload"
    }
}

Import an external backup.

HTTP Request

POST /stacks/{stack_id}/backups

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
group required integer The group ID of backups that imported backup must restored in 5
db_type required string Comma separated list of Database types which need backup tasks (valid options: mysql, postgresql, redis, mongodb) mysql
remote_url required string A URL to backup file to be imported https://s3.amazonaws.com/c66-managed-backup-non-prod/2aad2bb5a70e621ecf251fbd85af6927/backups/09a7dec0efdaa19b44148fccbf6128ec/redis/redis_23/2014.07.01.07.00.46/redis_23.tar

Backups files list

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
backup_id = 4153
response = token.get("#{api_url}/stacks/#{stack_id}/backups/#{backup_id}/files.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/backups/{backup_id}/files HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":[
    {
      "id":"tar",
      "name":"test_db_11.tar"
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }

Get list of all backup files of a stack.

HTTP Request

GET /stacks/{stack_id}/backups/{backup_id}/files

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
backup_id required integer Backup ID 4153

Backup file

stack_id = '5999b763474b0eafa5fafb64bff0ba80'
backup_id = 4153
id = 'tar-aa'
response = token.get("#{api_url}/stacks/#{stack_id}/backups/#{backup_id}/files/#{id}.json")

puts JSON.parse(response.body)['response']
GET /stacks/{stack_id}/backups/{backup_id}/files/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "ok":true,
      "public_url":"https://c66-managed-backup-non-prod.s3.amazonaws.com/2aad2bb5a70e621ecf251fbd85af6927/backups/3c656a1bcc160769762763c6276c18b9/mysql/test_db_11/2014.09.01.18.16.14/test_db_11.tar?AWSAccessKeyId=AKIAIKCYITLQBEJDIETQ\u0026Expires=1409603570\u0026Signature=C2au7Jq%252F1m6uHGHRfGJPn%252F2GSS8%253D"
    }
}

Get the public URL to a backup file.

HTTP Request

GET /stacks/{stack_id}/backups/{backup_id}/files/{id}

Query parameters

Parameter Presence Data type Description Sample value
stack_id required string The stack UID 5999b763474b0eafa5fafb64bff0ba80
backup_id required integer Backup ID 4153
id required string The file ID tar-aa

Accounts

Accounts list

response = token.get("#{api_url}/accounts.json")

puts JSON.parse(response.body)['response']
GET /accounts HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "id": 139,
      "owner": "test@cloud66.com",
      "created_at_iso": "2013-06-19T11:08:03Z",
      "updated_at_iso": "2014-02-20T12:55:58Z",
      "stack_count": 2,
      "used_clouds": ["digitalocean","rackspace"]
    }
  ],
  "count":1,
  "pagination":{
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 1,
    "pages": 1
  }
}

Get a list of accounts that caller belongs to.

HTTP Request

GET /accounts

Account

id = 1
response = token.get("#{api_url}/accounts/#{id}.json")

puts JSON.parse(response.body)['response']
GET /accounts/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
          "id": 139,
          "owner": "test@cloud66.com",
          "created_at_iso": "2013-06-19T11:08:03Z",
          "updated_at_iso": "2014-02-20T12:55:58Z",
          "stack_count": 2,
          "used_clouds": ["digitalocean","rackspace"]
    }
}

Get information about an account.

HTTP Request

GET /accounts/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The account ID 1

Users

Users list

response = token.get("#{api_url}/users.json")

puts JSON.parse(response.body)['response']
GET /users HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": [
    {
      "id": 1,
      "email": "jack@gmail.com",
      "primary_account_id": 1,
      "locked": false,
      "access_profile": {
        "account_profile": {
          "can_create_stack": true,
          "can_admin_users": true,
          "can_payment": true,
          "can_add_cloud_key": true,
          "can_del_cloud_key": true,
          "can_view_acc_notifications": true,
          "can_edit_acc_notifications": true,
          "can_view_audit": true,
          "can_view_docker_img_key": true,
          "can_del_ssh_key": true,
          "can_edit_personal_token": true,
          "can_del_authorized_app": true,
          "can_view_custom_env": true,
          "can_edit_custom_env": true,
          "can_add_developers_app": true,
          "can_del_developers_app": true,
          "can_edit_git_key": true,
          "can_edit_gateway": true,
          "default_roles": [
            "Administrator"
          ]
        },
        "stack_profiles": [
          {
            "stack_uid": "d1f1d43bb86ff3e97c9f6ff2841e42cb",
            "role": "Administrator"
          },
          {
            "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
            "role": "Administrator"
          },
          {
            "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
            "role": "Administrator"
          }
        ]
      },
      "uses_tfa": false,
      "timezone": "UTC",
      "has_valid_phone": false,
      "developer_program": false,
      "github_login": false,
      "last_login": "2016-01-29T15:25:20Z",
      "devices": [
        {
          "device_type": 1,
          "sub_type": 2,
          "token": "wertqy",
          "enabled": true,
          "created_at": "2014-08-04 11:57:36 UTC",
          "updated_at": "2014-08-04 12:03:22 UTC",
          "created_at_iso": "2014-08-04T11:57:36Z",
          "updated_at_iso": "2014-08-04T12:03:22Z"
        }
      ],
      "created_at": "2015-08-14T19:45:28Z",
      "updated_at": "2016-02-01T11:23:38Z",
      "cloud_status": "healthy"
    },
    {
      "id": 2,
      "email": "jim@gmail.com",
      "primary_account_id": 2,
      "locked": false,
      "access_profile": {
        "account_profile": {
          "can_create_stack": true,
          "can_admin_users": false,
          "can_payment": false,
          "can_add_cloud_key": false,
          "can_del_cloud_key": true,
          "can_view_acc_notifications": false,
          "can_edit_acc_notifications": true,
          "can_view_audit": false,
          "can_view_docker_img_key": false,
          "can_del_ssh_key": false,
          "can_edit_personal_token": false,
          "can_del_authorized_app": false,
          "can_view_custom_env": false,
          "can_edit_custom_env": false,
          "can_add_developers_app": false,
          "can_del_developers_app": false,
          "can_edit_git_key": false,
          "can_edit_gateway": false,
          "default_roles": [
            "Viewer"
          ]
        },
        "stack_profiles": [
          {
            "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
            "role": "Deployer"
          },
          {
            "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
            "role": "Viewer"
          },
          {
            "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
            "role": "Administrator"
          },
          {
            "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
            "role": "Administrator"
          }
        ]
      },
      "uses_tfa": false,
      "timezone": "UTC",
      "has_valid_phone": false,
      "developer_program": false,
      "github_login": false,
      "last_login": "2016-01-28T13:12:16Z",
      "devices": [],
      "created_at": "2016-01-28T13:12:13Z",
      "updated_at": "2016-01-28T13:12:16Z",
      "cloud_status": "healthy"
    }
  ],
  "count": 2,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 2,
    "pages": 1
  }
}

Get list of users that caller has access to.

HTTP Request

GET /users

User

id = 1
response = token.get("#{api_url}/users/#{id}.json")

puts JSON.parse(response.body)['response']
GET /users/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response": {
    "id": 2,
    "email": "jim@gmail.com",
    "primary_account_id": 2,
    "locked": false,
    "access_profile": {
      "account_profile": {
        "can_create_stack": true,
        "can_admin_users": false,
        "can_payment": false,
        "can_add_cloud_key": false,
        "can_del_cloud_key": true,
        "can_view_acc_notifications": false,
        "can_edit_acc_notifications": true,
        "can_view_audit": false,
        "can_view_docker_img_key": false,
        "can_del_ssh_key": false,
        "can_edit_personal_token": false,
        "can_del_authorized_app": false,
        "can_view_custom_env": false,
        "can_edit_custom_env": false,
        "can_add_developers_app": false,
        "can_del_developers_app": false,
        "can_edit_git_key": false,
        "can_edit_gateway": false,
        "default_roles": [
          "Viewer"
        ]
      },
      "stack_profiles": [
        {
          "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
          "role": "Deployer"
        },
        {
          "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
          "role": "Viewer"
        },
        {
          "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
          "role": "Administrator"
        },
        {
          "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
          "role": "Administrator"
        }
      ]
    },
    "uses_tfa": false,
    "timezone": "UTC",
    "has_valid_phone": false,
    "developer_program": false,
    "github_login": false,
    "last_login": "2016-01-28T13:12:16Z",
    "devices": [],
    "created_at": "2016-01-28T13:12:13Z",
    "updated_at": "2016-01-28T13:12:16Z",
    "cloud_status": "healthy"
  }
}

Get detailed information about a user.

HTTP Request

GET /users/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The user UID 1

Update User

id = 1
response = token.put("#{api_url}/users/#{id}.json", {body: { payload }})
# payload is a the same as the result of GET /user/{id}.json
PUT /users/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 2,
    "email": "jim@gmail.com",
    "primary_account_id": 2,
    "locked": false,
    "access_profile": {
      "account_profile": {
        "can_create_stack": true,
        "can_admin_users": false,
        "can_payment": false,
        "can_add_cloud_key": false,
        "can_del_cloud_key": true,
        "can_view_acc_notifications": false,
        "can_edit_acc_notifications": true,
        "can_view_audit": false,
        "can_view_docker_img_key": false,
        "can_del_ssh_key": false,
        "can_edit_personal_token": false,
        "can_del_authorized_app": false,
        "can_view_custom_env": false,
        "can_edit_custom_env": false,
        "can_add_developers_app": false,
        "can_del_developers_app": false,
        "can_edit_git_key": false,
        "can_edit_gateway": false,
        "default_roles": [
          "Viewer"
        ]
      },
      "stack_profiles": [
        {
          "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
          "role": "Deployer"
        },
        {
          "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
          "role": "Viewer"
        },
        {
          "stack_uid": "740f81b98eb847fab0df538ea8780d9d",
          "role": "Administrator"
        },
        {
          "stack_uid": "b5f4eaaf56b5768f272ab875d2ba48b1",
          "role": "Administrator"
        }
      ]
    },
    "uses_tfa": false,
    "timezone": "UTC",
    "has_valid_phone": false,
    "developer_program": false,
    "github_login": false,
    "last_login": "2016-01-28T13:12:16Z",
    "devices": [],
    "created_at": "2016-01-28T13:12:13Z",
    "updated_at": "2016-01-28T13:12:16Z",
    "cloud_status": "healthy"
}

Update user information. Currently only access profile section changes are applied.

HTTP Request

GET /users/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The user UID 1

Add Device

id = 1
token = 'htyukjbnnmshthkr'
response = token.post("#{api_url}/users/#{id}/devices.json", {body: {:device_type => 1, :sub_type => 1, :token => token}})

puts JSON.parse(response.body)['response']
POST /users/{id}/devices HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
  "response":
    {
      "device_type": 1,
      "sub_type": 1,
      "token": "mmccdd",
      "enabled": true,
      "created_at": "2014-09-01 09:15:50 UTC",
      "updated_at": "2014-09-01 09:15:50 UTC",
      "created_at_iso": "2014-09-01T09:15:50Z",
      "updated_at_iso": "2014-09-01T09:15:50Z"
    }
}

Add a new device for the user.

HTTP Request

POST /users/{id}/devices

Query parameters

Parameter Presence Data type Description Sample value
id required integer The user UID 1
device_type required integer Device type (1 = iOS, 2 = Android) 1
sub_type required integer Device subtype (1 = iPhone, 2 = iPad, 3 = iPod) 1
token required string The token of the device htyukjbnnmshthkr

Update Device

id = 1
token = 'htyukjbnnmshthkr'
response = token.put("#{api_url}/users/#{id}/devices.json", {body: {:device_type => 1, :sub_type => 1, :token => token}})

puts JSON.parse(response.body)['response']
PUT /users/{id}/devices HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

Update device_type or sub_type of a device

HTTP Request

PUT /users/{id}/devices

Query parameters

Parameter Presence Data type Description Sample value
id required integer The user UID 1
device_type required integer Device type (1 = iOS, 2 = Android) 1
sub_type required integer Device subtype (1 = iPhone, 2 = iPad, 3 = iPod) 1
token required string The token of the device htyukjbnnmshthkr

Delete Device

id = 1
token = 'htyukjbnnmshthkr'
response = token.delete("#{api_url}/users/#{id}/devices/#{token}.json")

puts JSON.parse(response.body)['response']
DELETE /users/{id}/devices/{token} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

Delete a device

HTTP Request

DELETE /users/{id}/devices/{token}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The user UID 1
token required string The token of the device htyukjbnnmshthkr

Gateways

Gateways list

account_id = '1234'
response = token.get("#{api_url}/accounts/#{account_id}/gateways.json")

puts JSON.parse(response.body)['response']
GET /accounts/{account_id}/gateways HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{
   "response":[
      {
        "id"=>1,
        "name"=>"aws_bastion",
        "username"=>"ec2-usr",
        "address"=>"1.1.1.1",
        "private_ip"=>"2.2.2.2",
        "ttl"=>"2016-02-01T14:46:38Z",
        "content"=>"N/A",
        "created_at_iso"=>"2016-02-01T14:37:05Z",
        "updated_at_iso"=>"2016-02-01T14:47:01Z",
        "created_by"=>"user1@cloud66.com",
        "updated_by"=>"user1@cloud66.com"
      }
   ],
   "count":1,
   "pagination":{
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
   }
}

Get a list of all the gateways of the account

HTTP Request

GET /accounts/{account_id}/gateways

Query parameters

Parameter Presence Data type Description Sample value
account_id required string The account id 12345

Gateway Create

account_id = '1234'
response = token.post("#{api_url}/accounts/#{account_id}/gateways.json", {body: {:name => 'aws_test', :username => 'ec2-usr', :address => '1.1.1.1', :ttl => 3600, :private_ip => '2.2.2.2', :content => 'xxxxxxxxxxxxx'}})

puts JSON.parse(response.body)['response']
POST /accounts/{account_id}/gateways HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

{ "response":
    {
        "ok": true
    }
}

Create a new gateway under the account. name must be passed as params. You can also specify username , address, ttl, private_ip and content as params.

HTTP Request

POST /accounts/{account_id}/gateways

Query parameters

Parameter Presence Data type Description Sample value
account_id required string The account id 12345
name required string New gateway name new_gateway_name
username optional string Username of bastion server ec2-usr
address optional string Public IP or DNS address of bastion server 1.1.1.1
ttl optional integer The number of seconds you want the gateway available 3600
private_ip optional string Private IP or DNS address of bastion server 2.2.2.2
content optional string The content of private key of bastion server xxxxxxxx

Update Gateway

account_id = '1234'
id = 1

response = token.put("#{api_url}/accounts/#{account_id}/gateways/#{id}.json", {body: { :name => 'new_name', :username => 'ubuntu' , :address => '1.2.3.4' }})

puts JSON.parse(response.body)['response']

PUT /accounts/{account_id}/gateways/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
{ "response":
    {
        "ok": true
    }
}

Update gateway information.

HTTP Request

PUT /accounts/{account_id}/gateways/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The gateway id 1
account_id required string The account id 12345
name optional string Gateway name new_gateway_name
username optional string Username of bastion server ec2-usr
address optional string Public IP or DNS address of bastion server 1.1.1.1
ttl optional integer The number of seconds you want the gateway available 3600
private_ip optional string Private IP or DNS address of bastion server 2.2.2.2
content optional string The content of private key of bastion server xxxxxxxx

Delete Gateway

account_id = '1234'
id = 1
response = token.delete("#{api_url}/accounts/#{account_id}/gateways/#{id}.json")
puts JSON.parse(response.body)['response']
DELETE /accounts/{account_id}/gateways/{id} HTTP/1.1
X-RateLimit-Limit: 3600
X-RateLimit-Remaining: 3597
HTTP/1.1 200 OK
Content-Type: application/json

Delete a gateway

HTTP Request

DELETE /accounts/{account_id}/gateways/{id}

Query parameters

Parameter Presence Data type Description Sample value
id required integer The gateway id 1
account_id required string The account id 12345