NAV
cURL Python

Cloudify REST API V2.1

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Welcome to Cloudify’s REST API Documentation!

The base URI for the v2.1 REST API is: /api/v2.1.

Variable

Response Fields Filtering (Projection)

Request Example (receive only the id and created_at fields)

$ curl -X GET "<manager-ip>/api/v2.1/blueprints?_include=id,created_at"
# Python Client-
blueprints = client.blueprints.list(_include=['id','created_at'])
for blueprint in blueprints:
  print blueprint

# Python Requests-
url = "http://<manager-ip>/api/v2.1/blueprints"
querystring = {"_include":"id,created_at"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/blueprints",
  "method": "GET",
  "data": {_include='id,created_at'},
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.blueprints.delete('<blueprint-id>');
</script>

Response Example

{
  "items": [
    {
      "created_at": "2015-11-11 13:11:40.324698",
      "id": "hello-world"
    }
  ],
  "metadata": {
    "pagination": {
      "total": 1,
      "offset": null,
      "size": 10000
    }
  }
}

You can choose to have only specific fields in the response by using the _include query parameter.

The parameter value is a comma separated list of fields to include in the response, e.g. _include=field1,field2,field3

Note that specified field names must be part of the resource schema, otherwise an error is raised.

Query Filtering (Selection)

Request Example (requesting only blueprints which id is _myblueprint1 or _myblueprint2)

$ curl -X GET "<manager-ip>/api/v2.1/blueprints?id=my_blueprint1&id=my_blueprint2&_include=id,created_at"
# Python Client-
blueprints = client.blueprints.list(_include=['id','created_at'],id=['my_blueprint1','my_blueprint2'])
for blueprint in blueprints:
    print blueprint

# Python Requests-
url = "http://<manager-ip>/api/v2.1/blueprints"
querystring = {"_include":"id,created_at","id":{"my_blueprint1","my_blueprint2"}}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/blueprints?id=my_blueprint1&id=my_blueprint2&_include=id%2Ccreated_at",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.blueprints.get(['my_blueprint1','my_blueprint2'],['id','created_at']);
</script>

Response Example

{
  "items": [
    {
      "created_at": "2015-12-02 11:27:48.527776",
      "id": "my_blueprint2"
    },
    {
      "created_at": "2015-12-02 11:23:01.939131",
      "id": "my_blueprint1"
    }
  ],
  "metadata": {
    "pagination": {
      "total": 2,
      "offset": 0,
      "size": 10000
    }
  }
}

You can make your query more specific by using filters.

Filters are query parameters where the key is a field name and the value is a field value, e.g. id=my-specific-id

Filters also accept multiple values (OR) by using multiple parameters of the same key, e.g. id=my-specific-id&id=another-id

Sorting

Request Example #1 (sort deployments by id descending)

$ curl -X GET "<manager-ip>/api/v2.1/deployments?_sort=-id&_include=blueprint_id,id"
# Python Requests-
url = "http://<manager-ip>/api/v2.1/deployments"
querystring = {"_sort":"-id","_include":"blueprint_id,id"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/deployments?_sort=-id&_include=blueprint_id%2Cid",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Response Example #1

{
  "items": [
    {
      "id": "hello1",
      "blueprint_id": "hello-world"
    },
    {
      "id": "dep4",
      "blueprint_id": "my_blueprint2"
    },
    {
      "id": "dep3",
      "blueprint_id": "my_blueprint1"
    },
    {
      "id": "dep2",
      "blueprint_id": "my_blueprint2"
    },
    {
      "id": "dep1",
      "blueprint_id": "my_blueprint1"
    }
  ],
  "metadata": {
    "pagination": {
      "total": 5,
      "offset": 0,
      "size": 10000
    }
  }
}

Request Example #2 (sort deployments by blueprint_id ascending and id descending)

$ curl -X GET "http://<manager-ip>/api/v2.1/deployments?_sort=blueprint_id&_sort=-id&_include=blueprint_id,id"
# Python Requests-
url = "http://<manager-ip>/api/v2.1/deployments"
querystring = {"_sort":"blueprint_id,-id","_include":"blueprint_id,id"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/deployments?_sort=blueprint_id&_sort=-id&_include=blueprint_id%2Cid",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Response Example #2

{
  "items": [
    {
      "id": "hello1",
      "blueprint_id": "hello-world"
    },
    {
      "id": "dep3",
      "blueprint_id": "my_blueprint1"
    },
    {
      "id": "dep1",
      "blueprint_id": "my_blueprint1"
    },
    {
      "id": "dep4",
      "blueprint_id": "my_blueprint2"
    },
    {
      "id": "dep2",
      "blueprint_id": "my_blueprint2"
    }
  ],
  "metadata": {
    "pagination": {
      "total": 5,
      "offset": 0,
      "size": 10000
    }
  }
}

Sort resources by using the _sort query parameter, e.g. _sort=id

The default sort order is ascending; to make it descending, prefix the field with a minus sign, e.g. _sort=-id (example #1)

Sorting also works on multiple fields by using multiple _sort parameters, where the sort sequence corresponds to the order of _sort parameters in the request (example #2).

Pagination

Request Example (skip 1 resource, get size of 4)

$ curl -X GET "http://<manager-ip>/api/v2.1/events?_size=4&_offset=1&_include=@timestamp"
# Python Requests
url = "http://<manager-ip>/api/v2.1/events"
querystring = {"_size":"4","_offset":"1","_include":"@timestamp"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/events?_size=4&_offset=1&_include=%40timestamp",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Response Example

{
  "items": [
  {
    "@timestamp": "2015-12-01T15:05:36.692Z"
  },
  {
    "@timestamp": "2015-12-01T15:05:37.493Z"
  },
  {
    "@timestamp": "2015-12-01T15:03:57.911Z"
  },
  {
    "@timestamp": "2015-12-01T15:03:58.025Z"
  }
  ],
  "metadata": {
    "pagination": {
      "total": 171,
      "offset": 1,
      "size": 4
    }
  }
}

If the response includes too many items for the client to handle at once, use pagination to get only a subset of the results, defined by two parameters:

* both parameters are optional.

The response metadata returns the requested parameters, and a total field which indicates the size of the full set.

Authentication

Authentication headers should be added to every request sent to a secured manager.
Any header can be used, as long as it’s support by one of the manager’s authentication providers. The default manager configuration supports basic HTTP authentication (examples #1, #2) and tokens (example #3).
Valid credentials do not affect the returned response, but invalid credentials return a “User Unauthorized” error.

Request Example #1 (Get the server’s status, authenticate with username and password)

$ curl -X GET "<manager-ip>/api/v2.1/status"
# Python Client-
client.manager.get_status()

# Python Requests-
url = "http://<manager-ip>/api/v2.1/status"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/status",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.manager.get_status();
</script>

Response Example #1

{
   "status":"running",
   "services":[
      {
         "display_name":"Celery Management",
         "instances":[
            {
               "Id": "cloudify-mgmtworker.service",
               "Description":"Cloudify Management Worker Service",
               "LoadState":"loaded",
               "state":"running"
            },
         ]
      },
      ...
   ]
}

Request Example #2 (Get a token, authenticate with username and password)

$ curl -u 'MY_USERNAME':'MY_PASSWORD' "<manager-ip>/api/v2.1/token"

Response Example #2

{
   "value":"eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ1MDAzMjI0MiwiaWF0IjoxNDUwMDMxNjQyfQ.eyJ1c2VybmFtZSI6ImF"
}

Request Example #3 (Get all the blueprints, authenticate with a token)

$ curl -H 'Authentication-Token:MY_TOKEN' "<manager-ip>/api/v2.1/blueprints"

Response Example #3

{
   "items":[
      {
         "main_file_name":"openstack-blueprint.yaml",
         "description":"This Blueprint installs a nodecellar application on an openstack environment",
         "created_at":"2015-12-13 19:00:03.160167",
         "updated_at":"2015-12-13 19:00:03.160167",
         "plan":{
            "relationships":{
               "cloudify.openstack.server_connected_to_port":{
                                 "name":"cloudify.openstack.server_connected_to_port",
               ...
               }
            }
         }
      }
   ]
}

Blueprints

The Blueprint Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string A unique identifier for the blueprint.
description string The blueprint’s description.
main_file_name string The blueprint’s main file name.
plan dict The parsed result of the blueprint.
created_at datetime The time the blueprint was uploaded to the manager.
updated_at datetime The last time the blueprint was updated.

Get Blueprint

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/blueprints?id=hello-world"
# Python Client-
client.blueprints.get(blueprint_id='hello-world')

# Python Requests-
querystring = {"id":"hello-world"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/blueprints?id=hello-world",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.blueprints.get('hello-world', null, function(err, response, body) {
                var blueprint = body;
    });
</script>

Response Example

{
  "updated_at": "2015-11-08 11:11:36.039194",
  "created_at": "2015-11-08 11:11:36.039194",
  "main_file_name": "singlehost-blueprint.yaml",
  "description": "Deploys a simple Python HTTP server on an existing machine.",
  "id": "hello-world",
  "plan": {
    "relationships": {},
    "inputs": {},
    "deployment_plugins_to_install": [],
    "policy_types": {},
    "outputs": {},
    "version": {},
    "workflow_plugins_to_install": {},
    "groups": {},
    "workflows": {},
    "nodes": [],
    "policy_triggers": {}
  }
}

GET "{manager-ip}/api/v2.1/blueprints?id={blueprint-id}"

Gets a specific blueprint.

URI Parameters

Response

A Blueprint resource.

Upload Blueprint

Request Example

$ curl -X PUT "http://<manager-ip>/api/v2.1/blueprints/<blueprint-id>?application_file_name=<blueprint-id>.yaml&
blueprint_archive_url=https://url/to/archive/master.zip"
# Python Client-
client.blueprints._upload(archive_location='https://url/to/archive/master.zip',
                          blueprint_id='<blueprint-id>',application_file_name='<blueprint-id>.yaml')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/blueprints/<blueprint-id>"
querystring = {"application_file_name":"<blueprint-id>.yaml",
               "blueprint_archive_url":"https://url/to/archive/master.zip"}
headers = {'content-type': "application/json"}
response = requests.request("PUT", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/blueprints/<blueprint-id>?application_file_name=<blueprint-id>.yaml&
  blueprint_archive_url=https://url/to/archive/master.zip",
  "method": "PUT",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.blueprints.publish_archive('https://url/to/archive/master.zip',
                                      '<blueprint-id>','<blueprint-id>.yaml')

    });
</script>

PUT "{manager-ip}/api/v2.1/blueprints/{blueprint-id}?application_file_name={blueprint-id}.yaml& blueprint_archive_url=https://url/to/archive/master.zip"

Uploads a blueprint to Cloudify’s manager. The call expects an “application/octet-stream” content type where the content is a zip/tar.gz/bz2 archive. It is possible to upload a blueprint from a URL by specifying the URL in the blueprint_archive_url request body property.

URI Parameters

Request Body

Property Type Description
application_file_name string The main blueprint file name in the blueprint’s archive.
blueprint_archive_url string A URL the blueprint to be uploaded should be downloaded from by the manager.

Response

A Blueprint resource.

List Blueprints

Request Example

$ curl -X GET "<manager-ip>/api/v2.1/blueprints?_include=id,created_at"
# Python Client-
blueprints = client.blueprints.list(_include=['id','created_at'])
for blueprint in blueprints:
  print blueprint

# Python Requests-
url = "http://<manager-ip>/api/v2.1/blueprints"
querystring = {"_include":"id,created_at"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/blueprints?_include=id%2Ccreated_at",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.blueprints.list('<blueprint-id>', function(err, response, body){
                var blueprints = body.items;
    });
</script>

GET "{manager-ip}/api/v2.1/blueprints"

Lists all blueprints.

Response

Field Type Description
items list A list of Blueprint resources.

Delete Blueprint

Request Example

$ curl -X DELETE "<manager-ip>/blueprints/<blueprint-id>"
# Python Client-
client.blueprints.delete(blueprint_id='<blueprint-id>')

# Python Requests-
url = "http://<manager-ip>/blueprints/<blueprint-id>"
headers = {'content-type': "application/json"}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http:<manager-ip>/blueprints/<blueprint-id>",
  "method": "DELETE",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.blueprints.delete('<blueprint-id>')
</script>

DELETE "{manager-ip}/api/v2.1/blueprints/{blueprint-id}"

Deletes a specific blueprint.

URI Parameters

Response

A Blueprint resource.

Download Blueprint

Downloads a specific blueprint as an archive.

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/blueprints/<blueprint-id>/archive"
# Python Client-
client.blueprints.download(blueprint_id='<blueprint-id>')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/blueprints/<blueprint-id>/archive"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/blueprints/<blueprint-id>/archive",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.download('<blueprint-id>')
</script>

GET "{manager-ip}/api/v2.1/blueprints/{blueprint-id}/archive"

URI Parameters

Response

The blueprint as an archive using an application/octet-stream content type.

Deployments

The Deployment Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string A unique identifier for the deployment.
blueprint_id string The id of the blueprint the deployment is based on.
created_at datetime The time when the deployment was created.
updated_at datetime The time the deployment was last updated at.
workflows list A list of workflows that can be executed on a deployment.
inputs object A dictionary containing key value pairs which represents a deployment input and its provided value.
policy_types object A dictionary containing policies of a deployment.
policy_triggers object A dictionary containing policy triggers of a deployment.
groups object A dictionary containing the groups definition of deployment.
outputs object A dictionary containing an outputs definition of a deployment.

Get Deployment

Request Example

$ curl -X GET "<manager-ip>/api/v2.1/deployments?id=hello1"
# Python Client-
print client.deployments.get(deployment_id='hello1')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/deployments"
querystring = {"id":"hello1"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/deployments?id=hello1",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.deployments.get('hello1');
</script>

Response Example

{
  "inputs": {
    "webserver_port": 8080,
    "agent_user": "centos",
    "server_ip": "localhost",
    "agent_private_key_path": "/root/.ssh/key.pem"
  },
  "policy_triggers": {
    "cloudify.policies.triggers.execute_workflow": {
      "source": "https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/
                master/resources/rest-service/cloudify/triggers/execute_workflow.clj",
      "parameters": {
        "workflow_parameters": {
          "default": {},
          "description": "Workflow paramters"
        }
        ...
      }
    }
  },
  "groups": {},
  "blueprint_id": "hello-world",
  "policy_types": {
    "cloudify.policies.types.threshold": {
      "source": "https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/
                master/resources/rest-service/cloudify/policies/threshold.clj",
      "properties": {
        "is_node_started_before_workflow": {
          "default": true,
          "description": "Before triggering workflow, check if the node state is started"
        }
        ...
      }
    }
  },
  "outputs": {
    "http_endpoint": {
      "description": "Web server external endpoint",
      "value": "http://localhost:8080"
    }
  },
  "created_at": "2015-11-08 06:53:45.845046",
  "workflows": [
    {
      "created_at": null,
      "name": "execute_operation",
      "parameters": {
        "operation_kwargs": {
          "default": {}
        }
        ...
      }
    },
    {
      "created_at": null,
      "name": "install",
      "parameters": {}
    }
  ],
  "id": "hello1",
  "updated_at": "2015-11-08 06:53:45.845046"
}

GET "{manager-ip}/api/v2.1/deployments?id={deployment-id}"

Gets a deployment.

URI Parameters

Response

A Deployment resource.

List Deployments

Request Example

$ curl -X GET "<manager-ip>/api/v2.1/deployments?blueprint_id=<blueprint-id>&_include=id,created_at"
# Python Client-
deployments = client.deployments.list(blueprint_id='<blueprint-id>',_include=['id','created_at'])
for deployment in deployments:
  print deployment

# Python Requests-
url = "http://<manager-ip>/api/v2.1/deployments"
querystring = {"blueprint_id":"<blueprint-id>","_include":"id,created_at"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/deployments?blueprint_id=<blueprint-id>&_include=id%2Ccreated_at",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.deployments.list(null, function(err, response, body){
                var deployments = body.items;
    });
</script>

GET "{manager-ip}/api/v2.1/deployments"

Lists all deployments.

Response

Field Type Description
items list A list of Deployment resources.

Create Deployment

Request Example

$ curl -X PUT -H "Content-Type: application/json" -d '{"inputs":{"image":"<image-id>","flavor":"<flavor-id>",
"agent_user":"<user-name>"}, "blueprint_id":"<blueprint-id>"}' "<manager-ip>/api/v2.1/deployments/<deployment-id>"
# Python Client-
client.deployments.create(blueprint_id='<blueprint-id>', deployment_id='<deployment-id>', inputs={
                          'image':'<image-id>','flavor':'<flavor-id>','agent_user':'<user-name>'})

# Python Requests-
url = "http://<manager-ip>/api/v2.1/deployments/<deployment-id>"
payload = "{\"inputs\":{\"image\":\"<image-id>\",\"flavor\":\"<flavor-id>\",\"agent_user\":\"<user-name>\"},
            \"blueprint_id\":\"<blueprint-id>\"}"
headers = {'content-type': "application/json"}
response = requests.request("PUT", url, data=payload, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/deployments/<deployment-id>",
  "method": "PUT",
  "headers": {"content-type": "application/json"},
  "data": "{\"inputs\":{\"image\":\"<image-id>\",\"flavor\":\"<flavor-id>\",\"agent_user\":\"<user-name>\"},
            \"blueprint_id\":\"<blueprint-id>\"}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.deployments.create('<blueprint-id>', '<deployment-id>',
                              {'image':'<image-id>','flavor':'<flavor-id>','agent_user':'<user-name>'});
</script>

PUT -d '{"inputs":{...}, "blueprint_id":"<blueprint-id>"}' "{manager-ip}/api/v2.1/deployments/{deployment-id}"

Creates a new deployment.

URI Parameters

Request Body

Property Type Description
blueprint_id string The id of the blueprint the new deployment will be based on (required).
inputs object The dictionary containing key value pairs which represents the deployment inputs.

Response

A Deployment resource.

Delete Deployment

Request Example

$ curl -X DELETE "<manager-ip>/deployments/<deployments-id>"
# Python Client-
client.deployments.delete(deployment_id='<deployments-id>')

# Python Requests-
url = "http://<manager-ip>/deployments/<deployment-id>"
headers = {'content-type': "application/json"}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http:<manager-ip>/deployments/<deployment-id>",
  "method": "DELETE",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.deployments.delete('<deployment-id>');
</script>

DELETE "{manager-ip}/api/v2.1/deployments/{deployment-id}"

Deletes a deployment.

An error is raised if the deployment has any live node instances. In order to ignore this validation, the ignore_live_nodes argument in request body can be used.

URI Parameters

Request Body

Property Type Description
ignore_live_nodes boolean Specifies whether to ignore the live nodes validation.

Response

A Deployment resource.

Events

The Event Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
event_type string Event type name
type string Indicates whether the resource is an event or a log (cloudify_event or cloudify_log)
tags list List of tags
timestamp ISO 8601 The time at which the event occurred on the executing machine
@timestamp ISO 8601 The time at which the event was logged on the management machine
message_code string Reserved, currently unused
context Context contains various identifiers related to the event
message Message contains the event message
level string Log level (only available in log events)
logger string Logger name
@version string Internal log entry version (logstash)

The Context object:

Attribute Type Description
task_id string Task id (only available in operation events)
task_name string Task name (only available in operation events)
task_queue string Task queue (only available in operation events)
task_target string Task target (only available in operation events)
operation string Operation path (only available in operation events)
task_total_retries integer Number of max retries, -1 if infinite (only available in operation events)
task_current_retries integer Number of attempted retries (only available in operation events)
plugin string Plugin name
blueprint_id string Blueprint id
node_name string Node name
node_id string Node instance id
workflow_id string Workflow id
deployment_id string Deployment id
execution_id string Execution id

The Message Object:

Attribute Type Description
text string Message text

List Events

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/events"
# Python Client-
events = client.events.list()
for event in events:
    print event

# Python Requests-
url = "http://<manager-ip>/api/v2.1/events"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/events",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.events.get( { execution_id : <execution-id> } );
</script>

Response Example

{
  "items": [
    {
      "level": "info",
      "timestamp": "2015-12-02 14:53:21.821+0000",
      "@timestamp": "2015-12-02T14:53:21.823Z",
      "tags": [
        "event"
      ],
      "message_code": null,
      "@version": "1",
      "context": {
        "task_id": "45f53924-af08-438c-88ac-34f5d76bb677",
        "blueprint_id": "hello-world",
        "plugin": "agent",
        "task_target": "hello1",
        "node_name": "vm",
        "workflow_id": "install",
        "node_id": "vm_6d480",
        "task_name": "cloudify_agent.installer.operations.create",
        "task_queue": "hello1",
        "operation": "cloudify.interfaces.cloudify_agent.create",
        "execution_id": "274d9cfb-42ae-4ba7-853d-bf0e990b5add",
        "deployment_id": "hello1"
      },
      "logger": "45f53924-af08-438c-88ac-34f5d76bb677",
      "type": "cloudify_log",
      "message": {
        "text": "Disabling requiretty directive in sudoers file"
      }
    },
    {
      "event_type": "task_started",
      "tags": [
        "event"
      ],
      "timestamp": "2015-12-02 14:53:23.593+0000",
      "@timestamp": "2015-12-02T14:53:23.664Z",
      "message_code": null,
      "@version": "1",
      "context": {
        "deployment_id": "hello1",
        "task_current_retries": 0,
        "task_id": "a0db8898-0fa1-4eae-ad1f-741f3253e6b2",
        "blueprint_id": "hello-world",
        "plugin": "agent",
        "task_target": "hello1",
        "node_name": "vm",
        "workflow_id": "install",
        "node_id": "vm_6d480",
        "task_name": "cloudify_agent.installer.operations.configure",
        "task_queue": "hello1",
        "operation": "cloudify.interfaces.cloudify_agent.configure",
        "task_total_retries": -1,
        "execution_id": "274d9cfb-42ae-4ba7-853d-bf0e990b5add"
      },
      "message": {
        "text": "Task started 'cloudify_agent.installer.operations.configure'",
        "arguments": null
      },
      "type": "cloudify_event"
    }
  ],
  "metadata": {
    "pagination": {
      "total": 2,
      "size": 10000,
      "offset": 0
    }
  }
}

GET "{manager-ip}/api/v2.1/events"

Lists all events.

GET "{manager-ip}/api/v2.1/events?_range=@timestamp,[time_start],[time_end]"

Lists all events within a time range:

Parameter Type Description
time_start ISO 8601 optional value to begin range with.
time_end ISO 8601 optional value to end range with.

time range: /api/v2.1/events?_range=@timestamp,2015-12-01,2015-12-31T14:30:00Z

all events since: /api/v2.1/events?_range=@timestamp,2015-12-01,

all events until: /api/v2.1/events?_range=@timestamp,,2015-12-31

Response

Field Type Description
items list A list of Event resources.

Executions

The Execution Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string A unique identifier for the execution.
workflow_id string The id/name of the workflow the execution is of.
blueprint_id string The id of the blueprint the execution is in the context of.
deployment_id string The id of the deployment the execution is in the context of.
status string The executions status.
error string The execution’s error message on execution failure.
created_at datetime The time the execution was queued at.
parameters object A dict of the workflow parameters passed when starting the execution.
is_system_workflow boolean true if the execution is of a system workflow.

Get Execution

Request Example

$ curl -X GET "<manager-ip>/api/v2.1/executions/2b422fb2-38b4-4b02-95ac-e9b91390599d?
deployment_id=hello1&_include=id,status,created_at"
# Python Client-
print client.executions.get(execution_id='2b422fb2-38b4-4b02-95ac-e9b91390599d',
                            _include=['id','created_at','status'])

# Python Requests-
url = "http://<manager-ip>/api/v2.1/executions/2b422fb2-38b4-4b02-95ac-e9b91390599d"
querystring = {"deployment_id":"hello1","_include":"id,status,create_at"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/executions/2b422fb2-38b4-4b02-95ac-e9b91390599d?
         deployment_id=hello1&_include=id%2Cstatus%2Ccreated_at",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.executions.get('execution-id', null, function(err, response, body) {
                    var execution = body;
    });
</script>

Response Example

{
  "status": "terminated",
  "created_at": "2015-11-18 06:54:14.238731",
  "workflow_id": "install",
  "is_system_workflow": false,
  "parameters": {},
  "blueprint_id": "hello-world",
  "deployment_id": "hello1",
  "error": "",
  "id": "2b422fb2-38b4-4b02-95ac-e9b91390599d"
}

GET "{manager-ip}/api/v2.1/executions/{execution-id}?deployment_id={deployment_id}"

Gets an execution.

URI Parameters

Response

An Execution resource.

List Executions

Request Example

$ curl -X GET "<manager-ip>/api/v2.1/executions?deployment_id=<deployment-id>&_include=id,status,
workflow_id,created_at"
# Python Client-
executions = client.executions.list(deployment_id='<deployment-id>',_include=['id','status',
                                    'workflow_id','created_at'])
for execution in executions:
  print execution

# Python Requests-
url = "http://<manager-ip>/api/v2.1/executions"
querystring = {"deployment_id":"<deployments-id>","_include":"id,created_at,workflow_id,status"}
headers = {'content-type': "application/json"}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/executions?deployment_id=<deployment-id>&
         _include=id%2Ccreated_at%2Cworkflow_id",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.executions.list({_include: 'id'}, function(err, response, body){
                var executions = body.items;
    });
</script>

GET "{manager-ip}/api/v2.1/executions?deployment_id={deployment-id}"

Lists all executions.

Response

Field Type Description
items list A list of Execution resources.

Start Execution

Request Example

$ curl -X POST -H "Content-Type: application/json" -d '{"deployment_id":"sample-dep",
"workflow_id":"install"}' "<manager-ip>/api/v2.1/executions"
# Python Client-
client.executions.start(deployment_id='<deployment-id>', workflow_id='install')

#Python Requests-
url = "http://<manager-ip>/api/v2.1/executions"
payload = "{\"deployment_id\":\"<deployment-id>\",\"workflow_id\":\"install\"}"
headers = {'content-type': "application/json"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/executions",
  "method": "POST",
  "headers": {"content-type": "application/json"},
  "data": "{\"deployment_id\":\"<deployment-id>\",\"workflow_id\":\"install\"}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.deployments.get('<deployment-id>', null, function (err, response, body) {
                var deployment = body;
                var workflow = _.find(deployment.workflows, {'name': 'install'});

                client.executions.start('<deployment-id>', workflow.name, workflow.parameters, false, false);
    });
</script>

POST -d '{"deployment_id":{deployments-id}, "workflow_id":"<workflow-id>"}' "{manager-ip}/api/v2.1/executions"

Starts an execution.

Request Body

Property Type Description
workflow_id string The workflow id/name to execute.
deployment_id string The id of the deployment the workflow should be executed on.
allow_custom_parameters boolean Specifies whether to allow custom parameters, which are not present in the parameters schema of the workflow, to be passed when starting the execution (default=false).
parameters object A dictionary containing parameters to be passed to the execution when starting it.
force boolean Specifies whether to force the workflow execution in a case where there is already a running execution in the context of the same deployment or system wide workflow (default=false).

Response

An Execution resource.

Cancel Execution

Request Example

$ curl -X POST -H "Content-Type: application/json" -d '{"deployment_id":"<deployment-id>",
"action":"cancel"}' "<manager-ip>/api/v2.1/executions/<execution-id>"
# Python Client-
client.executions.cancel(execution_id='<execution-id>')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/executions/<execution-id>"
payload = "{\"deployment_id\":\"<deployment-id>\",\"action\":\"cancel\"}"
headers = {'content-type': "application/json"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/executions/<execution-id>",
  "method": "POST",
  "headers": {"content-type": "application/json"},
  "data": "{\"deployment_id\":\"<deployment-id>\",\"action\":\"cancel\"}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.executions.cancel(execution.id, true);
</script>

POST -d '{"deployment_id":{deployment-id}, "action":"<action-method>"}' "{manager-ip}/api/v2.1/executions/{execution-id}"

Cancels an execution.

If passing cancel as the action fails to cancel the execution, force-cancel can be passed which will then kill the process running the execution.

URI Parameters

Request Body

Property Type Description
action string The cancellation method to perform: cancel or force-cancel

Response

An Execution resource.

Update Execution

PATCH "{manager-ip}/api/v2.1/executions/{execution-id}"

Updates an execution.

URI Parameters

Request Body

Property Type Description
status string The new status of the execution.

Response

An Execution resource.

Manager

The following REST API calls provide information about Cloudify’s manager.

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Status

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/status"
# Python Client-
client.manager.get_status()

# Python Requests-
url = "http://<manager-ip>/api/v2.1/status"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/status",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.manager.get_status();
</script>

Response Example

{
  "status": "running",
  "services": [
    {
      "instances": [
        {
          "LoadState": "loaded",
          "Description": "InfluxDB Service",
          "state": "running",
          "MainPID": 3609,
          "Id": "cloudify-influxdb.service",
          "ActiveState": "active",
          "SubState": "running"
        }
      ],
      "display_name": "InfluxDB"
    },
    {
      "instances": [
        {
          "LoadState": "loaded",
          "Description": "Cloudify Management Worker Service",
          "state": "running",
          "MainPID": 6565,
          "Id": "cloudify-mgmtworker.service",
          "ActiveState": "active",
          "SubState": "running"
        }
      ],
      "display_name": "Celery Management"
    }
    ...
  ]
}

GET "{manager-ip}/api/v2.1/events"

Gets Cloudify manager status.

Attributes:

Attribute Type Description
status string The status of the manager. Will always have a “running” value.
services list List of Service resources each, representing a service running in the manager.

The Service Object:

Attribute Type Description
instances list List of Instance resources representing the instances of a service running in a manager in a DBus structure.
display_name string The service name.

The Instance Object:

Attribute Type Description
LoadState string Contains a state value that reflects whether the configuration file of this unit has been loaded.
Description string The description of the service instance.
state string The state of the service instance (unknown, down, up, finish).
MainPID integer The process id of the main service instance process.
Id string The id of the service instance.
ActiveState string Contains a state value that reflects whether the unit is currently active or not. The following states are currently defined: active, reloading, inactive, failed, activating, deactivating.
SubState string Encodes states of the same state machine that ActiveState covers, but knows more fine-grained states that are unit-type-specific.

Information about the instance fields can be found in the DBus reference.

Version

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/version"
# Python Client-
client.manager.get_version()

# Python Requests-
url = "http://<manager-ip>/api/v2.1/version"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manaer-ip>/api/v2.1/version",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.manager.get_version();
</script>

Response Example

{
  "date": "",
  "commit": "",
  "version": "3.4.0-m5",
  "build": "85"
}

GET "{manager-ip}/api/v2.1/version"

Gets Cloudify manager version information.

Attributes:

Attribute Type Description
date ISO 8601 The date and time of the build the manager was built of.
commit string Git commit hash of the REST service code base used by the manager.
version string The version of Cloudify manager.
build string Build number.

Node Instances

The NodeInstance Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string The id of the node instance.
deployment_id string The id of the deployment the node instance belongs to.
host_id string The Compute node instance id the node is contained within.
runtime_properties object The runtime properties of the node instance.
relationships list The relationships the node has with other nodes.
state string The node instance state.
version integer A version attribute used for optimistic locking when updating the node instance.

Get Node Instance

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/node-instances/vm_150f1"
# Python Client-
print client.node_instances.get(node_instance_id='vm_150f1')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/node-instances/vm_150f1"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/node-instances/vm_150f1",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.nodeInstances.get('vm_150f1', null);
</script>

Response Example

{
  "relationships": [
    {
      "target_name": "vm",
      "type": "cloudify.relationships.contained_in",
      "target_id": "vm_150f1"
    }
  ],
  "runtime_properties": {},
  "node_id": "http_web_server",
  "version": 1,
  "state": "uninitialized",
  "host_id": "vm_150f1",
  "deployment_id": "hello1",
  "id": "http_web_server_7e234"
}

GET "{manager-ip}/api/v2.1/node-instances/{node-instance-id}"

Gets a node instance.

URI Parameters

Response

A NodeInstance resource.

List Node Instances

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/node-instances"
# Python Client-
instances = client.node_instances.list()
for instance in instances:
    print instance

# Python Requests-
url = "http://<manager-ip>/api/v2.1/node-instances"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/node-instances",
  "method": "GET",
  "headers": {"content-type": "application/json"},
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.nodeInstances.list('<deployment-id>', null);
</script>

Response Example

{
  "items": [
    {
      "relationships": [
        {
          "target_name": "nodejs_host",
          "target_id": "nodejs_host_7f66d",
          "type": "cloudify.relationships.contained_in"
        }
      ],
      "version": null,
      "runtime_properties": {},
      "state": "uninitialized",
      "node_id": "nodejs",
      "host_id": "nodejs_host_7f66d",
      "deployment_id": "d1",
      "scaling_groups": [],
      "id": "nodejs_d5a3e"
    },
    {
      "relationships": [
        {
          "target_name": "nodejs_host",
          "target_id": "nodejs_host_83396",
          "type": "cloudify.relationships.contained_in"
        }
      ],
      "version": null,
      "runtime_properties": {},
      "state": "uninitialized",
      "node_id": "nodejs",
      "host_id": "nodejs_host_83396",
      "deployment_id": "d1",
      "scaling_groups": [],
      "id": "nodejs_836e3"
    },
    {
      "relationships": [
        {
          "target_name": "mongod_host",
          "target_id": "mongod_host_fa1d1",
          "type": "cloudify.relationships.contained_in"
        }
      ],
      "version": null,
      "runtime_properties": {},
      "state": "uninitialized",
      "node_id": "mongod",
      "host_id": "mongod_host_fa1d1",
      "deployment_id": "d1",
      "scaling_groups": [],
      "id": "mongod_9961b"
    }
  ],
  "metadata": {
    "pagination": {
      "total": 28,
      "offset": 0,
      "size": 10000
    }
  }
}

GET "{manager-ip}/api/v2.1/node-instances"

Lists all node instances.

Response

Field Type Description
items list A list of NodeInstance resources.

Update Node Instance

Requests Example

$ curl -X PATCH -H "Content-Type: application/json" -d 'version=0&state=starting&
runtime_properties={key: value}' "http://<manager-ip>/api/v2.1/node-instances?id=nodejs_host_7f66d"
# Python Client-
client.node_instances.update(node_instance_id='nodejs_host_7f66d', state='starting',
                             runtime_properties={'key': 'value'}, version=0)

# Python Requests-
url = "http://<manager-ip>/api/v2.1/node-instances"
querystring = {"id":"<node-instance-id>"}
headers = {'content-type': "application/json"}
response = requests.request("PATCH", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/node-instances?id=nodejs_host_7f66d",
  "method": "PATCH",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    var newState = 'starting';
    var newProperties = {
        'key': 'value'
    };
    client.nodeInstances.update('<node-instance-id>', newState, newProperties, 0)
</script>

Response Example

{
    "relationships": [
      {
      "target_name": "nodecellar_security_group",
      "type": "cloudify.openstack.server_connected_to_security_group",
      "target_id": "nodecellar_security_group_deb08"
      }
    ],
    "runtime_properties": {"key": "value"},
    "state": "starting",
    "version": 3,
    "host_id": "nodejs_host_7f66d",
    "deployment_id": "d1",
    "scaling_groups": [],
    "id": "nodejs_host_7f66d",
    "node_id": "nodejs_host"
}

PATCH "{manager-ip}/api/v2.1/node-instances?id={node-instance-id}"

Updates a node instance.

URI Parameters

Request Body

Property Type Description
runtime_properties object A dictionary containing the updated runtime properties of the node instance.
state string The new state of the node instance.
version integer The node instance current version (used for optimistic locking).

Response

A NodeInstance resource.

Nodes

The Node Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string The name of the node.
deployment_id string The id of the deployment the node belongs to.
blueprint_id string The id of the blueprint the node belongs to.
type string The type of the node.
type_hierarchy list The type hierarchy of the node (ancestors).
number_of_instances integer The number of node instances the node has.
planned_number_of_instances integer -
deploy_number_of_instances integer -
host_id string The Compute node name the node is contained within.
properties object The properties of the node.
operations object The operations the node exposes.
plugins list A list of plugins the node is using for executing its operations.
plugins_to_install list A list of required plugins to install in order to execute the node’s operations.
relationships list The relationships the node has with other nodes.

List Nodes

Request Example

$ curl -X GET "<manager-ip>/api/v2.1/nodes"
# Python Client-
nodes = client.nodes.list()
for node in nodes:
    print node

# Python Requests-
url = "http://<manager-ip>/api/v2.1/nodes"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/nodes",
  "method": "GET",
  "headers": {
    "content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.nodes.list('<deployment-id>', null, null)
</script>

Response Example

{
  "items": [
    {
      "operations": {
        "cloudify.interfaces.lifecycle.create": {
          "inputs": {},
          "has_intrinsic_functions": false,
          "plugin": "",
          "retry_interval": null,
          "max_retries": null,
          "executor": null,
          "operation": ""
        },
        ...
        }
      },
      "deploy_number_of_instances": "1",
      "type_hierarchy": [
        "cloudify.nodes.Root",
        "cloudify.nodes.SoftwareComponent",
        "cloudify.nodes.WebServer"
      ],
      "blueprint_id": "hello-world",
      "plugins": [
        {
          "distribution_release": null,
          "install_arguments": null,
          "name": "script",
          "package_name": "cloudify-script-plugin",
          "distribution_version": null,
          "package_version": "1.3",
          "supported_platform": null,
          "source": null,
          "install": false,
          "executor": "host_agent",
          "distribution": null
        }
      ],
      "host_id": "vm",
      "properties": {
        "port": 8080
      },
      "relationships": [
        {
          "source_operations": {
            "cloudify.interfaces.relationship_lifecycle.unlink": {
              "inputs": {},
              "has_intrinsic_functions": false,
              "plugin": "",
              "retry_interval": null,
              "max_retries": null,
              "executor": null,
              "operation": ""
            },
            ...
            }
          },
          "type_hierarchy": [
            "cloudify.relationships.depends_on",
            "cloudify.relationships.contained_in"
          ],
          "target_id": "vm",
          "type": "cloudify.relationships.contained_in",
          "properties": {
            "connection_type": "all_to_all"
          }
        }
      ],
      "plugins_to_install": null,
      "type": "cloudify.nodes.WebServer",
      "id": "http_web_server",
      "number_of_instances": "1",
      "deployment_id": "hello1",
      "planned_number_of_instances": "1"
    }
  ]
}

GET "{manager-ip}/api/v2.1/nodes"

Lists all nodes.

Response

Field Type Description
items list A list of Node resources.

Plugins

The Plugin Resource

Note

# include this code when using cloudify REST client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# import the requests module when using Requests in python-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string The ID assigned to the plugin upon upload.
package_name string The python package name.
archive_name string The plugin archive file name.
package_source string The python package source, i.e git, pip etc.
package_version string The python package version.
supported_platform string The supported platform for the plugin package, ‘any’ if the plugin is compatible with all platforms.
distribution string The OS distribution the plugin was compiled on. ‘None’ in-case the plugin is cross platform.
distribution_version string The OS distribution version the plugin was compiled on. ‘None’ in-case the plugin is cross platform.
distribution_release string The OS distribution release name the plugin was compiled on. ‘None’ in-case the plugin is cross platform.
wheels list A list of wheels contained in the plugin package.
excluded_wheels list a list of wheels that were excluded from the plugin package.
supported_py_versions list a list of python platforms supported by the plugin.
uploaded_at ISO 8601 The time and date the plugin was uploaded on to the Cloudify-Manager.

Get Plugin

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/plugins/0e56d421-ddf9-4fc3-ade5-95ba1de96366"
# Python Client-
print client.plugins.get(plugin_id='0e56d421-ddf9-4fc3-ade5-95ba1de96366')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/plugins/0e56d421-ddf9-4fc3-ade5-95ba1de96366"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/plugins/0e56d421-ddf9-4fc3-ade5-95ba1de96366",
  "method": "GET",
  "headers": {
    "content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.plugins.get( { plugin_id_id : <plugin-id> } );
</script>

Response Example

{
	"archive_name":"cloudify_script_plugin-1.2-py27-none-any-none-none.wgn",
	"package_name":"cloudify-script-plugin",
	"package_version":"1.2",
	"supported_platform":"any",
	"package_source":"cloudify-script-plugin==1.2",
	"distribution":null,
	"distribution_version":null,
	"distribution_release":null,
	"supported_py_versions":["py27"],
	"uploaded_at":"2015-12-06 11:32:46.799188",
	"id":"0e56d421-ddf9-4fc3-ade5-95ba1de96366",
	"wheels":["bottle-0.12.7-py2-none-any.whl",
			  "requests-2.7.0-py2.py3-none-any.whl",
			  "proxy_tools-0.1.0-py2-none-any.whl",
			  "cloudify_plugins_common-3.2.1-py2-none-any.whl"],
    "excluded_wheels":[]
}

GET "{manager-ip}/api/v2.1/plugins/{plugin-id}"

Gets a plugin.

URI Parameters

Response

A Plugin resource.

Delete Plugin

Request Example

$ curl -X DELETE "http://<manager-ip>/api/v2.1/plugins/0e56d421-ddf9-4fc3-ade5-95ba1de96366"
# Python Client-
client.plugins.delete(plugin_id='<plugin-id>')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/plugins/<plugin-id>"
headers = {'content-type': "application/json"}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/plugins/<plugin-id>",
  "method": "DELETE",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.plugins.delete( { plugin_id_id : <plugin-id> } );
</script>

DELETE "{manager-ip}/api/v2.1/plugins/{plugin-id}"

Deletes a plugin from the Cloudify-Manager.

URI Parameters

Request Body

Property Default Description
force false Specifies whether to force plugin deletion even if there are deployments that currently use it.

Response

The deleted Plugin resource.

List Plugins

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/plugins"
# Python Client-
plugins = client.plugins.list()
for plugin in plugins:
    print plugin

# Python Requests-
url = "http://<manager-ip>/api/v2.1/plugins"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/plugins",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.plugins.list(function(err, response, body){
                var plugins = body.items;
    });
</script>

GET "{manager-ip}/api/v2.1/plugins"

Lists all plugins.

Response

Field Type Description
items list A list of Plugin resources.
metadata dict Metadata relevant to the list response.

Upload Plugin

Request Example

$ curl -X PUT "http://<manager-ip>/api/v2.1/plugins/<plugin-id>?plugin_archive_url=https://url/to/archive.zip"
# Python Client-
client.plugins.upload(plugin_path='https://url/to/archive.zip')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/plugins/<plugin-ip>"
querystring = {"plugin_archive_url":"https://url/to/archive.zip"}
headers = {'content-type': "application/json"}
response = requests.request("PUT", url, headers=headers, params=querystring)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/plugins/<plugin-id>?plugin_archive_url=
         https%3A%2F%2Furl%2Fto%2Farchive.zip",
  "method": "PUT",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.plugins.upload('https://url/to/archive.zip');
</script>

POST "{manager-ip}/api/v2.1/plugins/{plugin-id}"

Upload a plugins

Request Body

Property Type Description
plugin_path string The plugin archive local path.
plugin_archive_url string A URL of the plugin archive to be uploaded. The plugin will be downloaded by the manager.

Response

The new uploaded Plugin resource.

Download Plugin

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/plugins/<plugin-id>/archive"
# Python Client-
client.plugins.download(plugin_id='<plugin-id>')

# Pyhton Requests-
url = "http://<manager-ip>/api/v2.1/plugins/<plugin-id>/archive"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/plugins/<plugin-id>/archive",
  "method": "GET",
  "headers": {
    "content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.plugins.download('<plugin-id>');
</script>

GET "{manager-ip}/api/v2.1/plugins/{plugin-id}/archive"

Downloads a plugin.

URI Parameters

Response

The requested plugin archive.

Snapshots

The Snapshot Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
id string A unique identifier of the snapshot.
created_at ISO 8601 The time the snapshot was uploaded to or created on the manager.
status string Status of the snapshot. One of created/failed/uploading/uploaded.
error string Message of an error if snapshot creation failed.

List Snapshots

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/snapshots"
# Python Client-
snapshots = client.snapshots.list()
for snapshot in snapshots:
    print snapshot

# Python Requests-
url = "http://<manager-ip>/api/v2.1/snapshots"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/snapshots",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.snapshots.list(function(err, response, body){
              var snapshots = body.items;
  });
</script>

Response Example

{
    "items": [
        {
            "created_at": "2015-12-04 13:34:45.080009",
            "error": "",
            "id": "snapshot1",
            "status": "created"
        },
        {
            "created_at": "2015-12-04 13:35:04.972249",
            "error": "",
            "id": "snapshot2",
            "status": "created"
        }
    ],
    "metadata": {
        "pagination": {
            "offset": 0,
            "size": 10000,
            "total": 2
        }
    }
}

GET "{manager-ip}/api/v2.1/snapshots"

Lists all snapshots.

Response

Attribute Type Description
items list A list of Snapshot resources.

Create Snapshot

Requests Example

$ curl -X PUT "http://<manager-ip>/api/v2.1/snapshots/<snapshot-id>"
# Python Client-
client.snapshots.create(snapshot_id='<snapshot-id>')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/snapshots/<snapshot-id>"
headers = {'content-type': "application/json"}
response = requests.request("PUT", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/snapshots/<snapshot-id>",
  "method": "PUT",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.snapshots.create('<snapshot-id>');
</script>

PUT "{manager-ip}/api/v2.1/snapshots/{snapshot-id}"

Creates a new snapshot.

URI Parameters

Request Body

Property Type Description
include_metrics string Specifies whether metrics stored in InfluxDB should be included in the created snapshot. It defaults to false.
include_credentials string Specifies whether agent SSH keys (including those specified in uploaded blueprints) should be included in the created snapshot. It defaults to false.

Response

An Execution resource representing the create snapshot workflow execution.

Delete Snapshot

Requests Example

$ curl -X DELETE "http://<manager-ip>/api/v2.1/snapshots/<snapshot-id>"
# Python Client-
client.snapshots.delete(snapshot_id='<snapshot-id>')

# Python Requests-
url = "http://<manager-ip>/api/v2.1/snapshots/<snapshot-id>"
headers = {'content-type': "application/json"}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/snapshots/<snapshot-id>",
  "method": "DELETE",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<script>
    var client = new window.CloudifyClient({'endpoint': 'http://<manager-ip>/api/v2.1'});
    client.snapshots.delete('<snapshot-id>');
</script>

DELETE "{manager-ip}/api/v2.1/snapshots/{snapshot-id}"

Deletes an existing snapshot.

URI Parameters

Response

An empty Snapshot resource, with one non-empty field (its id).

Restore Snapshot

POST "{manager-ip}/api/v2.1/snapshots/{snapshot-id}/restore"

Restores the specified snapshot on the manager.

URI Parameters

Request Body

Property Default Description
force false Specifies whether to force restoring the snapshot on a manager that already contains blueprints/deployments.
recreate_deployments_envs true Specifies whether deployment environments should be created for restored deployments.

Response

An Execution resource representing the restore snapshot workflow execution.

Download Snapshot

GET "{manager-ip}/api/v2.1/snapshots/{snapshot-id}/archive"

Downloads an existing snapshot.

URI Parameters

Response

A streamed response (content type application/octet-stream), which is a zip archive containing the snapshot data.

Upload Snapshot

PUT "{manager-ip}/api/v2.1/snapshots/{snapshot-id}/archive"

Uploads a snapshot to the Cloudify Manager. The call expects a application/octet-stream content type where the content is a zip archive. It is possible to upload a snapshot from a URL by specifying the URL in the snapshot_archive_url request body property.

URI Parameters

Request Body

Property Type Description
snapshot_archive_url string Optional parameter specifying a url to a snapshot that will be uploaded to the manager.

Response

A Snapshot resource.

Tokens

The Tokens Resource

Note

# include this code when using cloudify python client-
from cloudify_rest_client import CloudifyClient
client = CloudifyClient('<manager-ip>')

# include this code when using python requests-
import requests
CloudifyJS, the JavaScript client, is available at https://github.com/cloudify-cosmo/cloudify-js

Attributes:

Attribute Type Description
value string The value of the token

Get Token

Request Example

$ curl -X GET "http://<manager-ip>/api/v2.1/tokens"
# Python Client-
client.tokens.get()

# Python Requests-
url = "http://<manager-ip>/api/v2.1/tokens"
headers = {'content-type': "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)
var settings = {
  "crossDomain": true,
  "url": "http://<manager-ip>/api/v2.1/tokens",
  "method": "GET",
  "headers": {"content-type": "application/json"}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Response Example

{
	"value":"reltkwe5lk645jp0jdvsr345gkllsre"
}

GET "{manager-ip}/api/v2.1/tokens"

Gets a token.

Response

A Token resource.