How to consume RESTful APIs in Low-code
Tags: api, softwaredevelopment, integration, lowcode
Published: 2022-04-13 11:04:10

---
title: How to consume RESTful APIs in Low-code
published: true
date: 2021-11-29 15:17:15 UTC
tags: APIs,SoftwareDevelopment,Integration,LowCode
canonical_url: https://linx.software/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](https://github.com/linx-software/petstore-api) 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3z155cqys7h5l9gbze5v.png)
 

###2. Request Authentication
For this test, the default api-key ‘special-key’ was used

###3. Request parameters


![Request parameters](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucygeh5p07eddzp6yaoy.png)
 
###4. Response Data Object

![Response Data Object](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qjusg1cpu0z45amqr80h.png)
 


##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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9njgkbhloltdtasme1dw.png)
 


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](https://community.linx.software/community/t/tutorial-consuming-rest-apis/484)
[Guide: Build and host a low-code REST API](https://linx.software/the-ultimate-guide-to-building-a-low-code-rest-api-how-to-guide/)
[Watch:Building an API (using OpenAPI definition)](https://www.youtube.com/watch?v=dqS0EWx7ceI&t=1s)

The post [How to consume RESTful APIs in Low-code](https://linx.software/how-to-consume-restful-apis-in-low-code/) appeared first on [Linx](https://linx.software).