Designing Triggered Task Pipelines

Supported HTTP Methods

You can design your Pipelines to act like REST APIs. You can run Triggered Tasks using the following HTTP Methods from both Cloudplex and Groundplex instances:

  • POST
  • PUT
  • HEAD
  • GET

Pipeline Design for GET Requests

Triggered Tasks support viewing the output of a Pipeline. When you execute a Pipeline using a Triggered Task URL, the output can be included as response to the HTTP request. You can create a Pipeline to be used in this manner by leaving one output view unconnected. For example, a Pipeline that consists of only a File Reader Snap would return the contents of the file when the Task URL is requested. 

This feature works with both document and binary views. 

  • Document view: The response consists of a JSON-encoded array of each document read from the view. You can use a Document to Binary Snap as the final Snap in the Pipeline. Add a Binary Header with the field status and its value an HTTP response status code, as shown below:

  • Binary stream: The binary data's header is sent back to the client as the HTTP response header. The body of the binary data is directly streamed back to the client. You can use a formatter Snap, like the XML or CSV Formatter Snaps, to transform the output of a document view into a binary view if the default JSON-encoding does not work.

Pipeline Design for POST Requests

You can POST input to a Pipeline. If you send a document to a Pipeline, you can leave one input view unlinked and then do an HTTP POST call to the task URL. The content of the POST request is then turned into a document and fed into the Pipeline.

Consider the following options:

If the input view accepts documents, then the content of the POST request should be a JSON-encoded object or an array-of-objects.  

  • If it is a single object, that value is fed into the Pipeline. 
  • If it is an array of objects, each object will be separately fed into the Pipeline as documents.
  • If the input view accepts binary streams, a single stream containing the raw contents of the POST request is fed into the view.
  • Only one unlinked output view is supported; if more than one unlinked view is found, an error is returned when trying to request the Task URL.
  • The On-premises URL should be used when receiving data from a Pipeline running in an Groundplex.