Rest API in outsystems

How to Expose REST API In Outsystems

Ever tried to retrieve data from other’s data, yeah it’s a hell of a task, especially when you can not even sure that the issue is occurring from your side or is the response. Even when the REST API is considered the easiest API to work with but it’s not as easy said than done.

And when you need to work with API in Outsystems is another layer of challenge to all of us. From figuring out how API works here to how to use it, everything will be new, but no worries, in this blog, we will discuss everything you need to know to expose REST API from Outsystems.

Before we start, lets have a quick introduction of OutSystems to those who don’t know about it.

Outsystems, a powerful and efficient low code platform which enables the developer to create application of both reactive as well as mobile in less time and efforts. It basically follows drag and drop feature for development of application.

And one of the most important feature of Outsystem is API as it allows the Outsystems use different features which is provided in other technologies as well as could act as a bridge between different databases.

So, let’s get started!!!

A REST API is a type of web API that follows the principles of Representational State Transfer (REST), an architectural style for designing networked applications. It uses standard HTTP methods like GET, POST, PUT, and DELETE to interact with resources identified by URLs, typically exchanging data in formats such as JSON or XML.[redhat+2](https://www.redhat.com/en/topics/api/what-is-a-rest-api)​

What is API?

An API stands for Application Programming Interface. API can be explained as protocols and set of rules which makes it possible for different software application to communicate or transfer information with each other.

In simple words we can say that an API acts as a bridge between systems or different software applications by letting an application to request regarding the data, which in technical terms known as sending request or answer the request, which is also known as getting the response. In this way same as well as different servers can exchange data or information without any blocker or issue.

Now that we know what is API, let’s explore the most commonly used API type.

What is REST API?

A REST is also known as Representational State Transfer, and the API which follows the principle or protocols of REST, will be known as REST API.

REST is an architectural style for designing the networked application. In simple words we can say that REST have it’s own architecture and the API which follows it is called REST API. Other than that REST API also uses different HTTP methods like GET, POST, PUT, PATCH, and DELETE so perform required query in the database, by interacting with data which can be identified by URLs which will always be unique, while it should be kept in mind that REST API can exchange data only in JSON format.

Now that we understood what actually REST API is, let’s get to the next section where we are discussing different HTTP methods.

What are HTTP Methods?

HTTP methods are different types of methods that can be performed on the resources or database of the requested URL, These methods can be used to fetch the data to alter it, etc.

These methods are  of 5 types, they are as follows:-

GET:- This method is used to fetch the existing data from the resources.

POST:- This method is used when new data has to be created.

PUT:- This method is used when there are something to update in the existing data.

PATCH:- PATCH method also works as PUT, but in PUT method request needs to pass all the parameters

regardless if they are the same or different., otherwise, that parameter would be updated as blank. On the other hand, in PATCH method the request can carry just those parameters that will be altered, while other parameters won’t be affected at all.

DELETE :- As the name says this method is used to delete the records from the recourses.

How to Expose API in OutSystems?

Now as we have discussed someone should know about REST API. So now is the high time that we figure out how can we expose an API through Outsystems. Let’s get started !!!

Step 1 :

After opening the application click on the **Logic** tab on the top right of the screen with three other tabs. Where inside the **Integration** folder you can see **REST**. As shown in the picture below.

image

Step 2 :

Then hover on the **REST** and right click on it, there a submenu will be opened showing different options, then click on **Expose REST API**. For any confusion take reference from the given image.

image 1

Step 3 :

When you click on the it, you will see an folder named **RESTAPI1** is automatically created. Now right click on that folder and select **Add REST API Method**.

image 3

Step 4 :

When you double click on the **REST API Method** an action flow will open in which you can write the logic you wanted to execute. In the **REST API Method** you can choose the Method you wanted to create from the property of action, by default the GET method is selected.

image 3

Step 5 :

Then you can publish your module, and then when you right click on the **RESTAPI1** folder again and you choose the **Open Documentation** which will navigate you to the documentation, from where you can get the URL of you exposed API.

image 2

Similarly you can expose other method API’s too.

Conclusion

OutSystems is a low-code platform to consume the full potential of the developers with intention of making the coding a highly visual and easy to understand. But even doing so, OutSystems ensure that it has all the functionality which are in the core coding, as well a following best practices. With the capability of exposing REST APIs through OutSystems give the developers to build a scalable as well as flexible and secure integrations with external systems efficiently, also can perform all the possible HTTP methods of REST API.

If you find this article helpful and wanted to read more articles based on technical issue and Outsystem, the do subscribe our newsletter for weekly articles.

Thank you and Happy Coding.

Facebook
Pinterest
Twitter
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Newsletter

Signup our newsletter to get updated information, and insight about the technology

Latest article