Invoke a POST API
This procedure shows how to create a flow to invoke a POST API and uses connection properties to update API host information.
Prerequisites:
The body is one of the action input schema properties and is passed to the target schema.
Complete sample
code:
"flows": {
"postOrdersFlow" : {
"id": "postOrdersFlow",
"description": "postOrdersFlow",
"version": "0.1",
"start": "startState",
"specVersion": "0.8",
"functions": [
{
"name": "postOrdersFunction",
"operation": "connectivity::rest",
"type": "custom"
}
],
"states": [
{
"actions": [
{
"functionRef": {
"refName": "postOrdersFunction",
"arguments": {
"uri": "${.connectionProperties.baseURL + \"/orders\"}",
"method": "POST",
"body": "${ .input.body }"
}
},
"actionDataFilter": {
"results": "${ { body: .body, headers: .headers } }",
"toStateData": "${ .output }"
}
}
],
"name": "startState",
"type": "operation",
"end": true
}
]
}
}