HTTP
Connect UI Bakery to any open API source

Prerequisites

If your API is hosted behind the Firewall, add the following IP address to the Firewall whitelist:
52.176.109.125

Setup

To interact with the data via API, you'll need to use an HTTP Request action step and configure HTTP parameters based on the documentation (all applications providing APIs have related Developers API docs). We support all HTTP methods, Headers, Body, and Query Parameters. You can setup your own or select a preconfigured Default HTTP data source.
The main required parameter for the HTTP action is URL:
You can also specify additional parameters that can be required depending on the API:
  1. 1.
    Method - http request method - GET, POST, PUT, etc;
  2. 2.
    URL - url or path of the API endpoint;
  3. 3.
    Base URL - in case a data source is connected to the action, base API url can be provided so that you don't need to specify a whole URL for each action and can change it on the data source level once for all actions;
  4. 4.
    Headers - http request headers - string key value pairs;
  5. 5.
    Body - for methods such as POST/PUT, an http body can be specified as a JSON object or as a plain text;
  6. 6.
    Query params - url params added to the request url;
  7. 7.
    Transform result - pass a JS function to transform execution result or fix an error. {{data}}, {{error}}, {{res}} variables represents the result of the request.
If the HTTP data source server sets the cookies, these cookies will be passed for the subsequent requests to the server as well, but will not be visible in the {{res}}.
You can find them in the network tab of the Chrome dev tool for the request that is sent to execute the HTTP step.
Please note that to make the cookies work, you have to configure your HTTP API as a data source first.
For example, you can pass a JSON object in a Body of your request by adding a Content-Type header to it:
Adding a request Body

Input & Output

Input - no specific input is required. {{data}} and {{params}} variables can be used to access a previous step result or an incoming action's parameters.
Output - {{data}} - API request result, {{error}} - API request error, {{res}}- full HTTP response object.

cURL

UI Bakery allows you to import API requests via cURL
Add an HTTP request action step, click Import CURL, and paste your cURL command into the field. The system will fill in the configuration automatically. Then Run Action and check the Result tab.

Use cases

  1. 1.
    Load and send data from your or 3rd party APIs;
  2. 2.
    Integrate with 3rd party services such as Zapier, Integromate (Make), etc.

Examples

Load items from API and modify result

1. Create an action and set an API URL:
2. Enable Transform result and add a JavaScript function to modify the result. Learn more about the data mapping here.
3. Run action and check the result:

Send a form using API request

Let's take look at how to send a form to make a POST API request.
1. Add a form component to your page. Note, if you add a form while your load data action is selected in the action panel, the form will inherit the response structure, so that you don't need to configure it manually.
2. Create a new HTTP action, change its method to POST, open up Body tab and change it format to JS Object. Then reference your newly added form as {{ui.myForm.value}}:
3. Assign the action to the form's On Submit trigger - now whenever you click the Submit button, action will be executed and POST API request sent to the API:
4. Fill in the form, click Submit and check the result:

Troubleshooting & Debug

Sometimes your API may return an error, e.g. if any required field is missing or is not correct. To check what data has been sent to the server, you can open the Payload section of the result panel and investigate header, url, body and other sent parameters:
Copy link
Outline
Prerequisites
Setup
Input & Output
cURL
Use cases
Examples
Troubleshooting & Debug