Skip to content

REST: Workflow related api

bugzmanov edited this page Aug 1, 2012 · 15 revisions

Execute a workflow on the existing environment

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 map contains the following entries:

Entry name Entry predefined value Type Description
action execute String Predefined value of action
parameters В  JSON object parameters used by execution action

Parameters JSON object structure:

Entry name Type Description
variables Map of String pairs Workflow variable values customized by user


Example request:

{
    "action": "execute"
    "parameters" : {
        "workflow": "scale-up"
        "variables": {"nodesCount": 1}
    }
}

**Example results:** See example results for environment creation

## Cancel the executing workflow for an environment

**Path:** `/rest/projects/(projectId)/envs/(environment name)/actions`

**Type:** POST

**Path parameters:**

<table>
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
<tr>
<td>
projectId
</td>
<td>
Number
</td>
<td>
project id the env belong to
</td>
</tr>
<tr>
<td>environment name</td>
<td>String</td>
<td>name of the environment</td>
</tr>
</table>

**Request body structure**

Request body consists form a single JSON object that contains single key with predefined value:

<table>
<tr>
<th>
Entry name
</th>
<th>Entry value</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
<tr>
<td>
action
</td>
<td>cancel</td>
<td>
String
</td>
<td>
key with specific value
</td>
</tr>
</table>

**Example request:**
``` json
{ "action": "cancel" }

Get logs for step

Path: /rest/projects/(projectId)/envs/(**envName)**/logs/**stepId**

**Type:**В GET

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
envName String name of the environment

Content-type: text/plain

Returns logs for specified step or 'No logs yet' if step is not started yet, or no logging enabled for specific step.

Example results

2012-03-27 17:46:59.876: Starting phase provision
2012-03-27 17:46:59.905: Starting action JCloudsProvisionVm
2012-03-27 17:47:11.822: Action JCloudsProvisionVm finished with result ProvisionCompleted
2012-03-27 17:47:11.828: Starting action CheckPublicIpAction
2012-03-27 17:47:12.814: Action CheckPublicIpAction finished with result PublicIpCheckCompleted
2012-03-27 17:47:12.817: Starting action CheckPortAction

NOTE: You can get stepId from get environment details call.

Clone this wiki locally