This activity provides your flogo application the ability to invoke a REST service.
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/rest
Inputs and Outputs:
{
"inputs":[
{
"name": "method",
"type": "string",
"required": true
},
{
"name": "uri",
"type": "string",
"required": true
},
{
"name": "params",
"type": "params"
},
{
"name": "pathParams",
"type": "params"
},
{
"name": "queryParams",
"type": "params"
},
{
"name": "content",
"type": "object"
}
],
"outputs": [
{
"name": "result",
"type": "object"
}
]
}
Setting | Description |
---|---|
method | The HTTP method to invoke |
uri | The uri of the resource |
pathParams | The path parameters |
queryParams | The query parameters |
content | The message content |
params | The path parameters (Deprecated) |
Note: |
- pathParams: Is only required if you have params in your URI ( i.e. http://.../pet/:id )
- content: Is only used in POST, PUT, PATCH
Configure a task in flow to get pet '1234' from the swagger petstore:
{
"id": 3,
"type": 1,
"activityType": "tibco-rest",
"name": "Query for pet 1234",
"attributes": [
{ "name": "method", "value": "GET" },
{ "name": "uri", "value": "http://petstore.swagger.io/v2/pet/1234" }
]
}
Configure a task in flow to get pet '1234' from the swagger petstore via parameters.
{
"id": 3,
"type": 1,
"activityType": "tibco-rest",
"name": "Query for Pet",
"attributes": [
{ "name": "method", "value": "GET" },
{ "name": "uri", "value": "http://petstore.swagger.io/v2/pet/:id" },
{ "name": "params", "value": { "id": "1234"} }
]
}
Configure a task in flow to get pet from the swagger petstore using a flow attribute to specify the id.
{
"id": 3,
"type": 1,
"activityType": "tibco-rest",
"name": "Query for Pet",
"attributes": [
{ "name": "method", "value": "GET" },
{ "name": "uri", "value": "http://petstore.swagger.io/v2/pet/:id" },
],
"inputMappings": [
{ "type": 1, "value": "petId", "mapTo": "params.id" }
]
}