# Packages

No description provided by the author

# README


title: REST weight: 4706

tibco-rest

This trigger provides your flogo application the ability to start a flow via REST over HTTP

Installation

flogo install github.com/TIBCOSoftware/flogo-contrib/trigger/rest

Schema

Settings, Outputs and Endpoint:

{
  "settings": [
    {
      "name": "port",
      "type": "integer"
    }
  ],
  "output": [
    {
      "name": "pathParams",
      "type": "params"
    },
    {
      "name": "queryParams",
      "type": "params"
    },
    {
      "name": "header",
      "type": "params"
    },
    {
      "name": "content",
      "type": "object"
    }
  ],
  "endpoint": {
    "settings": [
      {
        "name": "method",
        "type": "string",
        "required" : true
      },
      {
        "name": "path",
        "type": "string",
        "required" : true
      }
    ]
  }
}

Settings

Trigger:

SettingDescription
portThe port to listen on

Endpoint:

SettingDescription
methodThe HTTP method
pathThe resource path

Example Configurations

Triggers are configured via the triggers.json of your application. The following are some example configuration of the REST Trigger.

POST

Configure the Trigger to handle a POST on /device

{
  "triggers": [
    {
      "name": "flogo-rest",
      "settings": {
        "port": "8080"
      },
      "endpoints": [
        {
          "actionType": "flow",
          "actionURI": "embedded://new_device_flow",
          "settings": {
            "method": "POST",
            "path": "/device"
          }
        }
      ]
    }
  ]
}

GET

Configure the Trigger to handle a GET on /device/:id

{
  "triggers": [
    {
      "name": "flogo-rest",
      "settings": {
        "port": "8080"
      },
      "endpoints": [
        {
          "actionType": "flow",
          "actionURI": "embedded://get_device_flow",
          "settings": {
            "method": "GET",
            "path": "/device/:id"
          }
        }
      ]
    }
  ]
}