# README


title: REST weight: 4618

REST

This activity allows you to invoke a REST service.

Installation

Flogo Web

This activity comes out of the box with the Flogo Web UI

Flogo CLI

flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/rest

Schema

Inputs and Outputs:

{
  "input":[
    {
      "name": "method",
      "type": "string",
      "required": true,
      "allowed" : ["GET", "POST", "PUT", "PATCH", "DELETE"]
    },
    {
      "name": "uri",
      "type": "string",
      "required": true
    },
    {
      "name": "proxy",
      "type": "string",
      "required": false
    },
    {
      "name": "pathParams",
      "type": "params"
    },
    {
      "name": "queryParams",
      "type": "params"
    },
    {
      "name": "header",
      "type": "params"
    },
    {
      "name": "skipSsl",
      "type": "boolean",
      "value": "false"
    },
    {
      "name": "content",
      "type": "any"
    }
  ],
  "output": [
    {
      "name": "result",
      "type": "any"
    },
    {
      "name": "status",
      "type": "integer"
    }
  ]
}

Settings

SettingRequiredDescription
methodTrueThe HTTP method to invoke (Allowed values are GET, POST, PUT, DELETE, and PATCH)
uriTrueThe URI of the service to invoke
proxyFalseThe address of the proxy server to be used
pathParamsFalseThe path parameters. This field is only required if you have params in your URI (for example http://.../pet/:id)
queryParamsFalseThe query parameters
headerFalseThe header parameters
skipSslFalseIf set to true, skips the SSL validation (defaults to false)
contentFalseThe message content you want to send. This field is only used in POST, PUT, and PATCH

Examples

Simple

The below example retrieves a pet with number '1234' from the swagger petstore:

{
  "id": "rest_2",
  "name": "Invoke REST Service",
  "description": "Simple REST Activity",
  "activity": {
    "ref": "github.com/TIBCOSoftware/flogo-contrib/activity/rest",
    "input": {
      "method": "GET",
      "uri": "http://petstore.swagger.io/v2/pet/1234"
    }
  }
}

Using Path Params

The below example is the same as above, itretrieves a pet with number '1234' from the swagger petstore, but uses a URI parameter to configure the ID:

{
  "id": "rest_2",
  "name": "Invoke REST Service",
  "description": "Simple REST Activity",
  "activity": {
    "ref": "github.com/TIBCOSoftware/flogo-contrib/activity/rest",
    "input": {
      "method": "GET",
      "uri": "http://petstore.swagger.io/v2/pet/:id",
      "params": { "id": "1234"}
    }
  }
}