Running a Workflow With Variable Substitution

If your flow has workflow variables already defined, you can override these values at run time using workflow variable substitution.

Procedure

  • Create a json payload. Here is an example of what this payload should look like:
    {
       "meta" : { "version" : 1},
      "variables" : [
                      { "name" : "@max_iteration" , "value" : "5"} ,
                      { "name" : "@cluster_size" , "value" : "5"} ,
                      { "name" : "@epsilon" , "value" : "0.01"} ,
                      { "name" : "@max_generations" , "value" : "1"}
                    ]
    }

    Note that these workflow variables are substituted into the original workflow as well as any included sub-flows.

    Sample:

    Assume that the above json payload is stored in a file called workflow_variables.txt.

    curl -i -H "Content-Type: application/json" -d @workflow_variables.txt -X POST "http://localhost:8080/alpinedatalabs/api/v1/json/workflows/6/run?token=0bab2f20d3194ebbcae7c10d060279868fa690ea"
    

    Response:

    A successful response will look like the following code.
    HTTP/1.1 200 OK
     Server: Apache-Coyote/1.1
     Content-Type: application/json;charset=UTF-8
     Content-Length: 151
     Date: Mon, 07 Apr 2014 20:16:20 GMT
     
     {"meta":{"workflowId":"6","processId":"5e71c8eb-9e9a-4272-9ab9-22d989f0dcd9","user":"1","state":"STARTED"},"message":"workflow started","results":""}