Blog Posts Process Management

Understanding REST APIs

Blog: AuraQuantic Blog

Communication with REST APIs is the method
that different software use to integrate and pass information to each other. It
can be described as set of rules that allow programs to talk to each other.

According to Wikipedia ´representational state transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. The term REST is used to describe any interface between systems, which directly uses HTTP to obtain data, or to indicate the execution of operations in any format (XML, JSON, etc.).

Basically, REST APIs are used to connect
two different software and to do this effectively, developers must document
these APIs and indicate which methods they are going to leave available for
external programs to connect and extract information.

Let’s take Facebook as an example. Some of
the methods that Facebook uses in its APIs enable other applications to connect
and obtain all the friends of a specific user.

REST relies on HTTP requests

The great advantage offered by REST API
technology over others such as SOAP is that they use the same structure as the
HTTP protocol to request and transfer data between different applications.

When we write an address in our web
browser´s location bar, it sends a GET request to the web server, and this in
turn sends back a response (REQUEST-RESPONSE).

For example, we open the browser and type https://www.auraquantic.com/

It then connects to the web server via a TCP/IP connection, and sends a request of this type:

GET /index.html HTTP/1.1
Host: www.auraquantic.com
Retorno de carro
HTTP/1.1
Date: Tue mar 2020 04:33:33 GMT
Server: Microsoft – IIS/10.0
Content-Type: text/html; charset=uft-8
Content-length: 1000
Retorno de carro
Text can reach up to a 1000 bytes

HTTP methods

The most common HTTP methods
are as follows:

Method Description *Interact with the server
GET Request some data from the web server No
POST Update data on the web server Yes
PUT Add new data on the web server Yes
PATCH Partially modify a resource Yes
DELETE Delete data from the web server Yes

*Interact means
that the request will make changes to the server. The clearest example is when
we modify a record from a web form and update the database on the web server.

How do we use a REST API

To explain this,
we will use the example of integrating of a low-code application development platform
(LCAP) such as AuraPortal with an RPA, in this case UiPath.

Both
technologies are used for process automation, but their area of influence is
different. Process
automation with robots
aims to reduce human intervention, especially for repetitive
tasks. Whereas a low-code tool, like AuraPortal, can automate end-to-end
processes and provide additional capabilities including monitoring, analysis,
decision management and report generation for continuous optimization.

In many cases
adding an RPA as an automated system within a workflow is beneficial for the
application and makes it easier for the people involved.

Obviously to do
this we need both applications to be able to connect and exchange information. For
this to be possible we need to know the characteristics of the UiPATH REST API
and create a connector using the tools inside AuraPortal.

In the UiPath
Orchestator API Guide
web page there is documentation of the methods that
UiPath makes available for developers to connect and carry out operations with
its API.

Any type of
operation that we initiate with the RPA will require authentication. In the Authentication
section it is said that the UiPath authentication system uses bearer tokens
(OAuth 2.0 authorization standard), and we must make a POST request to the URI
https://cloud.uipath.com/api/account/authenticate using our credentials.

Example of how to obtain a token in UiPath

As shown in this
example, the server returns the token in “result”

Creating the connector with AuraPortal

Once we have the
information, we must create a connector in AuraPortal by following the
instructions in the API manual.

In order to do
so we must access the Connectors section in Structure and click on the ‘Create
Connector’ button. The next step is giving a name to the connector, selecting
the function Rest – Custom Web Services, and the class _Rest – Custom Web
Services.

Rest connector

To configure the
connector, we click on Next, and select the Publish option so that the
connector can be used within an automated process. We’ll also need set the
appropriate date and encoding.

After which we
can start defining the connector’s operations. As mentioned before, any
operation we perform with the UiPath API will require an authentication token,
so logically the first step is to set up an authentication operation to obtain the
token.

We must follow
the steps in the API documentation to create a POST type operation, which
targets the UiPath authentication URL, and in Request we indicate the following
values:

{
«tenancyName» : «whichever_is_applicable»,
«usernameOrEmailAddress» : «your_username»,
 «password» : «whichever_is_applicable»
}

In Response we will assign to the parameter “result” an AuraPortal dictionary term to save the token.

{
«result»: «3_accessToken»,
}

When we execute a new operation with the API we must include this token in the Request Headers.

{
«result»: «3_accessToken»,
}

And follow the steps specified in the UiPath documentation to create the new operations.

Why do we need a REST API

One of the greatest
advantages of offering a REST API is that other developers can create
alternative services and reach market niches that the original product could
not.

We can say that
this is a way to find allies that will help the expansion of a brand.

Companies that
make good use of this are Evernote, Dropbox, eBay, Twitter, Instagram, Facebook.
A large number of their users reach them through other applications via APIs.

AuraPortal Remote Work's virtual assistant, enjoy working in a platform that adapts to your needs.

In terms of the
technology used, it should be noted that REST APIs are based on the HTTP
communication protocol, which is undoubtedly the most widespread at present.

The post Understanding REST APIs appeared first on AuraQuantic.

Leave a Comment

Get the BPI Web Feed

Using the HTML code below, you can display this Business Process Incubator page content with the current filter and sorting inside your web site for FREE.

Copy/Paste this code in your website html code:

<iframe src="https://www.businessprocessincubator.com/content/understanding-rest-apis-2/?feed=html" frameborder="0" scrolling="auto" width="100%" height="700">

Customizing your BPI Web Feed

You can click on the Get the BPI Web Feed link on any of our page to create the best possible feed for your site. Here are a few tips to customize your BPI Web Feed.

Customizing the Content Filter
On any page, you can add filter criteria using the MORE FILTERS interface:

Customizing the Content Filter

Customizing the Content Sorting
Clicking on the sorting options will also change the way your BPI Web Feed will be ordered on your site:

Get the BPI Web Feed

Some integration examples

BPMN.org

XPDL.org

×