Trigger Workflows with GET parameters instead of POST

In the typical world of using curl with Pliant, you would be doing a POST. In this flow, there is an input parameter named “input” and an Assign block to set the value of $result to equal $input

Using the curl command in a BASH shell, we see that it works fine with a POST:

curl -k -X POST "https://shga.pliant.lab/api/v1/trigger/admin/User/gettest?sync=true&api_key=7********************************************&worker_group=default" -H "content-type: application/json" -d '{"input":""default""}'

Output:
{"result":""default""}

By default, we can use GET to trigger a flow with its default parameters, like this:

curl -k -X GET "https://shga.pliant.lab/api/v1/trigger/admin/User/gettest?sync=true&api_key=7********************************************&worker_group=default"

But what about if we need to trigger flows using GET and we need to use input parameters?

We will use a System Variable. In the Start block, expand the SYSTEM VARIABLES area, enable the “body” variable, then note that it appears in the list above.

Now we can submit additional query parameters in the URL, and they will appear as properties of the $body object in the flow. If we change our flow from before to look like this, now assigning the value of $body.input to be the $result:

Then we run this curl command:

curl -k -X GET "https://shga.pliant.lab/api/v1/trigger/admin/User/gettest?sync=true&api_key=7**************************&worker_group=default&input=teststring"

Output:

{"result":"teststring"}

That URL we use in the GET command above could be embedded in a web page and would trigger the flow in the same way