- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10
REST: Environments related API
Path: /rest/projects/(projectId)/envs
Type: GET
Path parameters
| Parameter | Type | Description | 
|---|---|---|
| projectId | Number | project id of the project envs belong to | 
Request parameters
| Parameter | Type | Mandatory | Description | 
|---|---|---|---|
| filter | String | N | Sets filter's values. Currently possible filtering on the status of the environment. Example: filter=statuses[Destroyed,Broken] | 
Example results
[
    {
        "name":"test",
        "status":"Ready",
        "creator":"genesis",
        "templateName":"ErlangAmazon",
        "templateVersion":"0.1"
    }
]
Path: /rest/projects/(projectId)/envs
Type: POST
| Parameter | Type | Description | 
|---|---|---|
| projectId | Number | project id the created env should belong to | 
Request body structure
 Request body consists form a single JSON map contains the following entries:
| Entry name | Type | Description | 
|---|---|---|
| envName | String | Environment name | 
| creator | String | Environment creator name. Parameter is optional. Service uses current user identity to set creator. | 
| templateName | String | Name of the Environment template to use | 
| templateVersion | String | Version of the Environment template to use | 
| variables | Map of String pairs | Creation workflow variable values customized by user | 
Example request :
{
  "envName" : "erlt",
  "templateName" : "Erlang",
  "templateVersion" : "2.0",
  "variables":{"nodesCount": 4}
}Example results
Sucessful environment creation
{
    "serviceErrors":{},
    "variablesErrors":{},
    "compoundServiceErrors":[],
    "compoundVariablesErrors":[],
    "isSuccess":true
}Environment creation failed, environment with the same name already exists
{
    "serviceErrors":{
        "envName":"Environment with the same name already exists"
    },
    "variablesErrors":{},
    "compoundServiceErrors":[],
    "compoundVariablesErrors":[],
    "isSuccess":false
}Environment creation failed, required variable is not set
{
    "serviceErrors":{},
    "variablesErrors":{
        "nodesCount":"Variable 'nodesCount' is not set"
    },
    "compoundServiceErrors":[],
    "compoundVariablesErrors":[],
    "isSuccess":false
}Path: /rest/projects/(projectId)/envs/(environment name)
Type: DELETE
Path parameters:
| Parameter | Type | Description | 
|---|---|---|
| projectId | Number | project id the created env should belong to | 
| environment name | String | Name of the environment to be deleted | 
Example results: see example results for environment creation
Path: /rest/projects/(projectId)/envs/(environment name)
Type: GET
Path parameters:
| Parameter | Type | Description | 
|---|---|---|
| projectId | Number | project id the env belong to | 
| environment name | String | name of the environment | 
**Example results**
{
    "name":"test",
    "status":"Ready",
    "creator":"genesis",
    "templateName":"ErlangAmazon",
    "templateVersion":"0.1",
    "workflows":[
        {
            "name":"create",
            "variables":[
                {
                    "name":"nodesCount",
                    "description":"Erlang worker nodes count"
                }
            ]
        },
        {
            "name":"destroy",
            "variables":[]
        },
        {
            "name":"scale-up",
            "variables":[
                {
                    "name":"nodesCount",
                    "description":"Erlang worker nodes count"
                }
            ]
        }
    ],
    "createWorkflowName":"create",
    "destroyWorkflowName":"destroy",
    "vms":[
        {
            "envName":"test",
            "roleName":"erlangNode",
            "hostNumber":1,
            "instanceId":"eu-west-1/i-aa838edc",
            "hardwareId":"m1.small",
            "imageId":"eu-west-1/ami-359ea941",
            "publicIp":"46.137.40.65",
            "privateIp":"10.226.106.227",
            "status":"Ready"
        }
    ],
    "historyCount":1,
    "workflowCompleted":0.23
}Path: /rest/projects/(projectId)/envs/(environment name)/actions
Type: POST
Path parameters:
| Parameter | Type | Description | 
|---|---|---|
| projectId | Number | project id the env belong to | 
| environment name | String | name of the environment | 
Request body structure
Request body consists form a single JSON object that contains single key with predefined value:
| Entry name | Entry value | Type | Description | 
|---|---|---|---|
| action | resetEnvStatus | String | key with specific value | 
Example request:
{
    "action": "resetEnvStatus"
}Example results: see examples of [Common result object][1]
Path: /rest/projects/(projectId)/envs/(environment name)/history?page_offset=(number)&page_length=(number)
**Type:**В GET
Path parameters:
| Parameter | Type | Description | 
|---|---|---|
| projectId | Number | project id the env belong to | 
| environment name | String | name of the environment | 
Request parameters:
| Parameter | Type | Description | 
|---|---|---|
| page\_offset | Number | number of the first record in a selection | 
| page_length | Number | count of the records in a selection | 
Example results