Developers working with Flowize

How to process multiple API calls into one Synchronous API request

IN: API | Content | Development | Integration

Some services (software, websites and databases) are only supporting Synchronous API calls, but what do you do if the required information doesn’t come from only one source?

Nowadays you have to build a Connector on your service to handles those requests, you need to maintain them and when it’s hard coded it is also hard to change.

In this Example we want to show you how fast and easy you can perform multiple actions and provide the answer Synchronously back with only one API call

When do you use the Synchronous API function from Flowize?

  • If you need to need data from multiple data sources with only one API call
  • If you want to build an API on your own service
  • To generate personalized e-mails, P-urls, PDF’s or other content
  • To build your own API with API key check using the Flowize databases
  • When you want to change of supplier withou changing your current API call

The Flow below is started by a Synchronous API call from an existing CRM system. It will then generate a personalized invoice in PDF created in the Flowize Content Editor, it will check if it is generated correctly and sends the PDF in the initial API call as answer back.

How to build this?

Step 1: Copy your current API

If you already have a current API Request structure, you can easly paste some example data into Flowize. It will automatically recognize the structure. If you do not have a current structure, you can build it in the editor. In this example below we are using an existing JSON structure.

You can Save the newly created Interface and can Test it with the information given in the tab Test API.

After that we will create a SyncURL, here you can define the payload of a Default Success or Error answer. The Default Succes answer will be send if the Flow reaches a Scheduler or the End of a Flow. The Default Error answer will automaticcaly be send if there is an error in the Flow.

Step 2: Create your invoice

To create the Content you can choose an existing template from the Flowize Marketplace or build one yourself from scratch or import an existing HTML.

You can define all the variables from your API call in here, or even more which you have gathered from Apps in the workflow. After saving and publishing the content you can use it in the Flow.

Step 3: Build your flow

Your API structure is configured, you’ve created your invoice, now you can start building the Flow. In this example we are using the following Apps:

  • Slack: We will use this app to log the process in a Slack channel.
  • Generate PDF: This App will convert the HTML content to a PDF, replacing all the variables in it.
  • Decision: We will use this system object to validate the output of the previous app.
  • SyncURL – SUCCESS: If the invoice is generated succesfully, you can send it back in the payload via the API
  • SyncURL – ERROR: If there is an error in creating the invoice, due to missing fields or other reasons, you can send an Error message back.

Below you see how the define a Success Answer

  • Decide the Format type of the response
  • Add Headers if required
  • You can create any HTTP code you would like
  • Use the Payload the put the gathered information within Flowize in

Ready to go!

You can now make the API Request and see the generated PDF in the answer!

Ofcourse, this was just one example, but imagine what you could do else while building out the Flow!

Chris van der Veen

CEO at Flowize

Try Flowize today

Want to see Flowize in action? Book a free demo today and we will show you how we tailor Flowize to your exact needs so you can get the most out of the platform. Expect to be amazed.