Modelling API requests
To create a simple GET request through an external API, you need to select the Business Logic section and click Create API request button in the External API Requests tab. In the new modal window, enter the business process name and description (optional).
Then, select the method of request you need to perform, endpoint address and fill in the required request parameters (query params in the example below). In some cases, it is necessary to fill in the header, body and url params, depends on the task facing the user.
In the BP editor, you can also test the process by clicking Test request button. In the appeared window enter the request parameters and click on Execute request button. The response body will be received in the body tab if request performed successfully. Autofill Response parses the response and helps create the necessary models. By clicking on Autofill Response a response template for this endpoint will be automatically generated for further usage.
It is possible to create a data model knowing the response fields. To do this, you need to go to Data Design and create a new model filling it in according to the data that should be written to the database.
Using API requests in the backend
Then, open Business Logic section and click Create business project to create a BP for receiving data via an external API and writing into the specified Data Model. In the corresponding blocks you need to find the block of the newly created API process.
To make request working need to pass the appropriate parameters configured earlier in the editor of the external API request (Query Params in the example below). Use Make - Expand blocks combination to process and create data via BP. An example of creating and passing parameters is shown in the screenshot below.
Then the output body has to be expanded and written into the data model. In the example below, bitcoin price vs dollars (USD) is received.
In order to write the response data into the DB, Make and DB: Create type blocks are used.
Then you need to create an Endpoint for the newly created BP to get an access to it via frontend of web-application.
Using API requests in the frontend
From the application frontend you need to use Server request GET type of blocks for the specified endpoint as on the screenshot below.