Skip to content

REST: Workflow related api

Svyatoslav Reyentenko edited this page May 17, 2013 · 15 revisions

Get a count of currently running workflows

Path: /rest/workflow-stats

Type: GET

Example request


curl -u genesis:genesis http://genesis.example.com/rest/workflow-stats

Example response

{
   "links": [ ],
   "items": [
     {
       "projectId": 1,
       "runningWorkflows": 2,
       "links": [
         {
           "href": "http://localhost:8081/rest/projects/1/workflows/running",
           "rel": "collection",
           "type": "application/vnd.griddynamics.genesis.WorkflowDetails+json",
           "methods": [
             "get"
           ]
         }
       ]
     }
   ]
}

Get a list of running workflows per project

Path: /rest/projects/(projectId)/workflows/running

Type: GET

Path parameters:

Parameter Type Description
projectId Number project identifier

Example request


curl -u genesis:genesis http://genesis.example.com/rest/projects/1/workflows/running

Example response

[
  {
    "id":1,
    "name":"mock",
    "status":"Running",
    "startedBy":"nodoby",
    "variables":{"foo":"bar"},
    "executionStartedTimestamp":0
  }
]

Execute a workflow on the existing environment

Path: /rest/projects/(projectId)/envs/(environment id)/workflows/(workflow name)

Type: POST

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
environment id Int id of the environment
workflow name String workflow to execute


Request body structure
Request body consists form a single JSON map contains the following entries:

Entry name Entry predefined value Type Description
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:

{
"parameters" :
    {
        "variables": {"nodesCount": 1}
    }
}

Example results: See example results for environment creation

Cancel the executing workflow for an environment

Path: /rest/projects/(projectId)/envs/(environment id)/actions/cancel

Type: POST

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
environment id Int id of the environment

Request body structure

None

Get logs for step

Path: /rest/projects/(projectId)/envs/(envId)/logs/stepId

Type: GET

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
envId Int id 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.

Step history:action tracking

Get list of actions executed withing step

Path: /rest/projects/(projectId)/envs/(environment id)/steps/(stepId)/actions

**Type:**GET

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
environment id Int id of the environment
stepId Number id of a step

Example results

[
{"name":"Destroy Vm Action","description":"VmDestroyed","startedTimestamp":1341315620000,"finishedTimestamp":1341315620000,"status":"Succeed"},
{"name":"Destroy Vm Action","description":"VmDestroyed","startedTimestamp":1341315620000,"finishedTimestamp":1341315620000,"status":"Succeed"},
{"name":"Destroy Vm Action","description":"VmDestroyed","startedTimestamp":1341315620000,"finishedTimestamp":1341315621000,"status":"Succeed"},
{"name":"Destroy Vm Action","description":"VmDestroyed","startedTimestamp":1341315620000,"finishedTimestamp":1341315620000,"status":"Succeed"}
]
Clone this wiki locally