Invoke a GET API
This procedure shows how to create a flow to invoke a GET API.
The sample code implements a procedure that uses connection properties to retrieve API host information.
Prerequisites:
The action is defined in the schema. The header and parameters (query/path) are input to the action.
Complete sample
code:
"flows": {
"getCustomersCustomerIdFlow" : {
"id": "getCustomersCustomerIdFlow",
"description": "getCustomersCustomerIdFlow",
"version": "0.1",
"start": "startState",
"specVersion": "0.8",
"functions": [
{
"name": "getCustomersCustomerIdFunction",
"operation": "connectivity::rest",
"type": "custom"
}
],
"states": [
{
"actions": [
{
"functionRef": {
"refName": "getCustomersCustomerIdFunction",
"arguments": {
"uri": "${.connectionProperties.baseURL + \"/customers/{customer_id}\"}",
"method": "GET",
"headers": "${ .input.headers }",
"parameters": "${ .input.parameters }"
}
},
"actionDataFilter": {
"results": "${ { body: .body, headers: .headers } }",
"toStateData": "${ .output }"
}
}
],
"name": "startState",
"type": "operation",
"end": true
}
]
}
}