HTTP API
Last updated
Was this helpful?
Last updated
Was this helpful?
In this article, we'll explore how you can without actually having to connect the data source or HTTP API data source. We will also review the data source's .
Without connecting your own HTTP API, you can still run your requests with UI Bakery. In this case, you simply need to create a new action, select the HTTP API data source, and the HTTP Request action will be selected automatically. After that, just specify the URL of your request directly in the action. This is the main required parameter for the action type.
You can also specify additional parameters which may be required depending on the API:
Method - the HTTP Request method (GET, POST, PUT, etc.)
Base URL - When a data source is connected to the action, Base API URL can be provided not to specify the whole URL for each action. You can change it once on the data source level for all actions.
URL - the URL or path of the API endpoint
Headers - the HTTP Request headers (string key-value pairs)
Body - For POST/PUT/DELETE/PATCH methods, you can specify the HTTP body as a JSON object or as plain text.
Query Params - the URL params added to the Request URL
Transform result toggle - You can pass a JS function to transform execution result or fix an error. The {{data}}
, {{error}}
, and {{res}}
variables represents the result of the request.
For example, you can pass a JSON object in the Body of your request by adding a Content-Type
header to it:
If your HTTP Requests share similar settings such as Base URL or Auth headers or your API requires authentication, you can configure your own HTTP API as a data source. To do so, follow the instruction below:
On the Data sources page, click Connect, and select HTTP API in the Data sources list.
Click Connect Datasource to save the configuration.
Please note that the settings defined on the data source level are sent from the back-end proxy and are not exposed to the front-end user.
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 {{res}}
.
You can locate them in the network tab of the Chrome dev tool for the request that was sent to execute the HTTP step.
Please note that to make the cookies work, you have to first.
If your API is hosted behind a Firewall, you need to add our to the Firewall whitelist.
Specify the Base URL and any additional parameters if necessary. To set up authentication, refer to .
Once you've established the connection to the data source, you can start interacting with its data via API. For this purpose, you can use the action step and configure the HTTP parameters applicable to your API. UI Bakery supports all HTTP methods, Headers, Body, and Query Parameters.