Outputs

The output of an operation needs to be defined so Flow can use it. If you do not need any output, it is safe to define no output. The machine step will still return a record, consisting only of 'HttpStatusCode', 'ReasonPhrase' and 'AllHeaders'.

But typically you want to define the possible outputs of an operation. When you create a new operation one output is added by default. This output is for http status code '200'. If the operation does not ever return 200 you can delete it.

You can define multiple outputs for an operation, for example you might want one for http status code '200' another for '400', yet another for '500' etc. You might even need several outputs per http status code. An API can for instance always return '200', but in case of an error return an object describing the error instead of expected object. The REST Connector will try to parse the response from the API until it is successful. To control the order the connector tries to parse the response, use 'Priority' - where the output with highest priority (lower number) will be tried first. Two outputs with the same http status code cannot have the same 'Priority.

To define a new output you press 'NEW OUTPUT'.

- Parameter kind Always output - Http status code Specify for what Http status code that output is valid for. - Name A unique name for the output - Display name A more human readable name for the output (not required) - Description Currently purely a documentation feature for you as a REST connector designer. - Priority Applicable if there are more than one output on a given http status code. - Data type Here you specify the kind of output - None - Array - Boolean - Integer - Number - Object - String - File - Override content-type Here you can specify that REST connector should always consider the returned content to be of a specific content-type, regardless of what the actual response states. Applicable values are "application/json" and "application/xml". This is to mitigate situations where a remote API for instance states content-type "text/plain" even though it actually is "application/json".

See Parameters for more information about these types. Note that 'File' will translate to a 'Stream' in Flow. So if you download a file from a REST API (output is of type 'File') you can then use for instance the 'File System Connector' to write the stream to disk. Or another connector that can handle streams, such as SFTP, FTP or the Database connector. If the output is 'Object', you can also select an transformation (if there are any transformations available based on the selected model. See Model transform for more information.

You can also add one (and only one) 'DEFAULT OUTPUT'. The purpose of this output is to capture all http status codes not defined by another output.

Example

Let's look at an example with multiple outputs.

We got two outputs for http status code 200 defined.

Which leads to that when the operation is later used in Flow, it will have two records, one called 'OK' and one called 'Error'. At most one of the two will have a value after the REST call has been made.

This can be used for better error handling, for instance like this:

Last updated