How to return an API response from a destination

If required to use an API that requires a body to be sent and a response to be received, please follow the instructions below:

Illustrated in the image below is an example of a flow that prepares a JSON body to send to an API and retrieve the response back from the endpoint then saves the data into a buffer. In this example, the flow takes a food category in the form of a body request and then passes it to an API which returns a list of meal options, including the protein and fat of the meal.

In this example, a Start Flow source step is used as per the image below.


Add a Calculator step after the source step. The below image is an example of the body response to send to the API.

In the HTTP Service destination step, specify the URL, select any connections if required, and any other configuration required by the API as illustrated in the image below.

Note: Response Encoding is used to encode the response from the API, When working with files Response Encoding can be set to Binary.

After the HTTP Service destination step, add a Calculator and change input.record to input.result as per the image below. This will return the result from the API if a response can be returned from the API.

When testing a destination step, uncheck the Disable Destination Steps options to show the response from the HTTP Service in Synatic Step Debug window as per the image below.

When the flow is executed, the buffer will be populated as per the image below.