A2019 REST Web Services Command

In this post, we will learn the A2019 REST Web Services Command in Automation Anywhere. First of all, let’s understand the meaning of API in brief.

What is an API?

API (Application Programming Interface) is a set of rules or protocols to communicate between two applications.

An API is a computing interface that defines the interaction between multiple software intermediaries.

It defines:

  • The kinds of requests that can be made,
  • How to make them,
  • The data formats that should be used,
  • The conventions to follow, etc.

Introduction

Let’s look at the REST Web Services package of Automation Anywhere. This rest web service package is used to work with restful web services using the HTTP methods such as – GET, POST, PUT, DELETE, and PATCH.

Once, you create a bot in A2019, In the left pane, we get to see Actions. We can search for the rest action commands as shown below:

A2019 REST Web Services

We can drag-drop any of these methods as per our requirement.

A2019 REST Web Services Command Methods

There are 5 methods (at the time of writing this post) in REST Web Services Command of A2019.

GET

The GET method requests information as identified by the request URI.

POST

The POST method sends data to the server to create/update a resource.

PUT

The PUT method updates a record by passing different URI parameters based on the Key-Value pair.

DELETE

The DELETE method deletes the identified resource at the origin.

PATCH

The PATCH method partially replaces the information that is identified by the Request URI.



GET & POST In Action

In this post, we will help you understand the GET and POST method implementation.

Let’s create a bot in A2019. In case you don’t know the process of creating a bot, refer to our post on – Creating an A2019 bot.

Just drag and drop the command from the left pane. Also, we will create variables that would be needed later in this task.

User Defined Variables

Once. you drag-drop or double-click the GET method you will see the option to enter a few details as shown:

Here, we are using a fake API service for demo purposes.

When we execute the bot after configuring the GET method properly, we will get the output in the message box.

Bot Execution - GET Method

Now, let’s configure the POST method. With the help of a POST method, we will be able to create a new resource.



However, as we are using the fake API, the resource will not be created on the server.

Let’s enter the URI and configure the Content type.

A2019 REST Web Services Command

Then, we will add custom parameters in a JSON format and assign the output to our dictionary type variable named APIResponse.

A2019 REST Web Services Command

Note: The parameter format should match to one that is expected by the API.

Once, you have configured the methods properly and there are no errors in your bot, the output message would be displayed in a Message Box.

Congratulations!, you have successfully used the GET and POST methods.

Similarly, you can try using the other 3 methods of A2019 REST Web Services CommandPATCH, DELETE, and PUT. If you face any issues, let us know by commenting below this post.

Further Reading

If you’re interested in exploring more about A2019 REST Web Services Commands, refer to the official documentation.

Hope this post helps you understand A2019 REST Web Services Command. Spread a word with your friends and colleagues.

Happy Automation!

Share with your friends:

Leave a Reply