DEV Community

Linx Software
Linx Software

Posted on • Originally published at linx.software on

How to consume RESTful APIs in Low-code

APIs are created so that users can use them as a bridge to connect to applications and services. There are thousands of APIs available for consumption, and each API is unique. But it’s really easy to consume APIs to extend the capabilities of your Linx apps, even complex ones that require OAuth 2.0 tokens. Let us show you how with a real-life example.

Steps to Consume an API

1. Find the API you want to use

APIs can be categorized as Open APIs, Partner APIs and Private APIs. Open APIs are available to the public, whereas Partner APIs are offered to business partners (no public access). Private APIs are designed for internal use.

2. Request Access to consume API

Each API service has its own authorization method. In order to grant access to use an API, credentials are provided to users for further use of that API.

3. Go through the API reference documentation or guidelines on how to consume the API.

The API Documentation will provide endpoints with their respective details, including
– The URL (endpoint) of the operation
– Request authentication
– Request parameters (such as query values, body etc.)
– Response data object.

We’ve used the pet store API sample hosted at https://petstore3.swagger.io as an example to show you how LINX can be used to consume APIs from a REST Service.

The resulting app, based on the Swagger ‘Petstore’ OpenAPI definition is available for download on our Github page.

How to Call a REST Service in LINX

In the following example, we’ll call the method findByStatus.
We’ll break it down into 4 parts as above:

1. The URL (endpoint) of the operation

URL endpoint

2. Request Authentication

For this test, the default api-key ‘special-key’ was used

3. Request parameters

Request parameters

4. Response Data Object

Response Data Object

Building your solution

Once we’ve gathered all the information, we can start building the app to consume the above endpoint. In, you can easily consume REST APIs using the CallRESTEndpoint Plugin.

  1. Drag and drop the CallRESTEndpoint on the designer canvas.
  2. Choose the Authentication type.
  3. Fill in the information about the URL.
  4. Choose Method.
  5. If the REST API you are consuming requires specific headers or uses HTTP Authentication, fill in the necessary information.
  6. Fill in the information about the Body. If you choose JSON as body format, you have the option to use the Custom Linx Type to build the JSON structure. Check the API documentation to get complete details for body fields.
  7. Choose the Response Output Type. Check the API documentation to get complete details for response fields.

Call REST Service properties

Now you can start sending requests to the API. Run Linx in Debug Mode to test the API. In just a few steps, you can easily consume any API of your choice!

Further reading

Tutorial: Consuming REST APIs in low-code
Guide: Build and host a low-code REST API
Watch:Building an API (using OpenAPI definition)

The post How to consume RESTful APIs in Low-code appeared first on Linx.

Top comments (0)