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).

create_bp_1

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.

create_bp_2

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.

create_bp_3

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.

datamodel_4

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.

api_block_5

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.

businessmodel_in_6

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.

businessmodel_out_7

In order to write the response data into the DB, Make and DB: Create type blocks are used.

businessmodel_create_8

Then you need to create an Endpoint for the newly created BP to get an access to it via frontend of web-application.

create_endpoint_9

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.

bp_fe

Was this article helpful?

AppMaster.io 101 Crash Course

10 modules
2 weeks

Not sure where to start? Get going with our crash course for beginners and explore AppMaster from A to Z.

Start Course
Development it’s so easy with AppMaster!

Need More Help?

Solve any issue with the help of our experts. Save time and focus on building your applications.

headphones

Contact Support

Tell us about your problem, and we’ll find you a solution.

message

Community Chat

Discuss questions with other users in our chat.

Join Community