How to send API requests to Automai RPA using cURL?

This article will walk you through the format and syntax used when making Automai RPA API requests with cURL. cURL is a lightweight, command-line tool for making HTTP/HTTPS requests without a web browser. cURL lets you try out various API requests in a command-line interface such as the command prompt in Windows or Terminal in macOS.

Note: You can use any other API tools such as Postman to sends the API commands to Automai RPA Manager.

Using cURL in Windows

cURL isn't installed in Windows by default. You can download and install cURL as follows.

  1. In Windows machine, create a new folder called curl in your C: drive. C:\curl

  2. Go to cURL's Download page and download the version that is compatible with your Windows version. 

  3. Unzip the downloaded file and move the curl.exe file to your C:\curl folder.

Now, you can use the Windows command prompt to run the cURL commands. Go to C:\curl folder, type cmd in the search box, and press Enter.

Automai RPA API requests using cURL

Generate a Token

Authenticate the user with the Manager, and obtain a token.

Request:

XML: 

Curl -X POST -d "username=[username]&password=[password]" http://IP Address:port number/api/generatetoken

JSON:

Curl -X POST -d "username=[username]&password=[password]" http://IP Address:port number/api/generatetoken [-H "Accept: application/json"] 

Example: 

XML: 

Curl -X POST -d "username=admin&password=admin" http://172.169.12.51:8888/api/generatetoken

JSON:

Curl -X POST -d "username=admin&password=admin" http://172.169.12.51:8888/api/generatetoken -H "Accept: application/json"  

Response:

[Token Value] i.e. 6d83469eea9ffc77431c0013aeb944170a1699513f39

Create and play a Process Flow Run 

This takes the Process flow ID as input and creates a Process flow run based on an existing Process flow. Then it finds the available rWorkers and have them start executing the processes.

Request: 

XML: 

Curl -X POST http://IP Address:port number/api/createandplayfr -H "Authorization: Token [Token Value]" -d "f_id=[Process Flow ID]"

JSON:

Curl -X POST http://IP Address:port number/api/createandplaypfr -H "Authorization: Token [Token Value]" -d "f_id=[Process Flow ID]" [-H "Accept: application/json"]
Example: 

XML: 

Curl -X POST http://172.169.12.51:7777/api/createandplayfr -H "Authorization: Token 6d83469eea9ffc77431c0013aeb944170a1699513f39" -d "f_id=APF-65621"

JSON:

Curl -X POST http://172.169.12.51:7777/api/createandplayfr -H "Authorization: Token 6d83469eea9ffc77431c0013aeb944170a1699513f39" -d "f_id=APF-65621" -H "Accept: application/json"

Response:

The Process flow (i.e. APF-65621) will start playing.

Tip: You can find the desired Process flow ID next to the Process flow name in the "Process Flows" section.

Using cURL in macOS

cURL is installed by default on macOS. Just open the computer's terminal and try to send the API commands to Automai RPA Manager using the instructions given above.