Success and error response

The response definitions for success and error responses.

Response definitions for success and error responses contains the following:
  • Status code - The HTTP status code corresponding to the response.
  • Content type - The MIME type of the request body.
  • Response body - A typical response body returned from an API.

An API can be called from the Request screen. When the API is called, its response then populates the response body field of either the success or error response, based on the HTTP status returned by the API call. If the response is JSON, you can then provide instructions for how to filter the response or select output parameters from the response.

Before you define a filter, or output parameters, remember that if the returned JSON is large, it is advisible to compact the JSON response to reduce processing and storage overhead. The compact function analyzes JSON arrays of objects and replaces the list of objects with a single object. This single object contains a superset of the fields found in each object in the array.

A filter can be defined to discard unwanted JSON elements from the response. Frequently, APIs return complex JSON responses, where many of the elements in the response are not of interest. A filter can be defined whereby you can select the elements of interest, or select the elements to exclude from the response. When the endpoint is invoked from a map, or a flow, and if there is a filter defined, it will be applied, and only the selected elements will be returned to the map, or flow.

Similarly, output parameters can be defined for JSON fields in the response. Parameters can be used:
  • To directly populate flow variables when an endpoint is invoked from a flow. This simplifies flow logic, since the response does not need to be parsed by a node in the flow.
  • To pass data between steps in a composite endpoint.

Output parameters can be defined to fetch values either from the response body, or from headers sent in the response.