rest

package
v0.5.2-rc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

README

tibco-rest

This activity provides your flogo application the ability to invoke a REST service.

Installation

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

Schema

Inputs and Outputs:

{
  "input":[
    {
      "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": "header",
      "type": "params"
    },
    {
      "name": "content",
      "type": "object"
    }
  ],
  "output": [
    {
      "name": "result",
      "type": "object"
    }
  ]
}

Settings

Setting Description
method The HTTP method to invoke
uri The uri of the resource
pathParams The path parameters
queryParams The query parameters
header The header 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

Configuration Examples

Simple

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" }
  ]
}
Using Path Params

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"} }
  ]
}
Advanced

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" }
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildURI

func BuildURI(uri string, values map[string]string) string

BuildURI is a temporary crude URI builder

func NewActivity

func NewActivity(metadata *activity.Metadata) activity.Activity

NewActivity creates a new RESTActivity

Types

type RESTActivity

type RESTActivity struct {
	// contains filtered or unexported fields
}

RESTActivity is an Activity that is used to invoke a REST Operation inputs : {method,uri,params} outputs: {result}

func (*RESTActivity) Eval

func (a *RESTActivity) Eval(context activity.Context) (done bool, err error)

Eval implements api.Activity.Eval - Invokes a REST Operation

func (*RESTActivity) Metadata

func (a *RESTActivity) Metadata() *activity.Metadata

Metadata returns the activity's metadata

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL