How to Reset Your Automation Anywhere Device using API in Postman: A Step-by-Step Guide
In this tutorial, we are going to learn how to reset an Automation Anywhere device using API in Postman. This solution will also solve the issues below if you are using a Community or On-Prem Control Room.
BOT stuck in In Progress Stage and not able to move it to history
BOT stuck in Pending execution Stage and not able to move it to history
Cannot delete device, as it is part of an active bot deployment
Prerequisites
To complete this task, you will need:
Postman App or Web access
Automation Anywhere Control Room Link
Reset Device
Install Postman Desktop App
Launch Postman App
Create a POST request for Authentication and Hit Send button
Method: POST
URI:
https://<ControlRoom>/v1/authentication
Body:
{
"username": "{{CR_username}}",
"password": "{{CR_password}}"
}
Provide your Control Room details (URI, Username, and Password)
Response:
{
"token":"eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiIxIiwiY2xpZW50VHlwZSI6IldFQiIsImxpY2Vuc2VzIjpbXSwiYW5hbHl0aWNzTGljZW5zZXNQdXJjaGFzZWQiOnsiQW5hbHl0aWNzQ2xpZW50Ijp0cnVlLCJBbmFseXRpY3NBUEkiOnRydWV9LCJpYXQiOjE1NzMxMDc4NzMsImV4cCI6MTU3MzEwOTA3MywiaXNzIjoiQXV0b21hdGlvbkFueXdoZXJlIiwibmFub1RpbWUiOjM2NTc1NjI0OTQ2MzE2MDAsImNzcmZUb2tlbiI6ImNiZjgwZWNkZmU5YmUwYzViOGI2MDk3NmU0ZTI2MTNiIn0.rGYxbS5kKUTxtZhYtRSXpmIHwbf3IwLBIKDEA7odG5uGVAjD55Tv05bYdARx_3-tl1CBg_cDGbwj5FvaBt9u5xKu5W5j3Nur6x3PF62NeB3ZIdxiUPaFBU0Br84mPJMD4_EpwBfbeSVOMH6ngiLtJYhIOtJa0kp4pAAm3mvkuOUELtH8lf3pQf-2Ose2fUAaebDkqiH13SUF1TONAjUQv6Ef_uY0wgq9SjZwKHg9SKUhX3S8PXAJne_ih2QnN8nUE1SXGlkC04eoIvyWpFkM963XEjptc2uvwtVn42MdA4Nd1opD5yijEl9VM92Fe1sPb6_T5-oV-U1Iw0JHiX2-Ug",
"user":{
"id":9,
"email":"user@domain.com",
"username":"user",
"domain":null,
"firstName":"user",
"lastName":"u",
"version":9,
"principalId":9,
"deleted":false,
"roles":[
{
"name":"API_Key_Generation",
"id":23,
"version":0
},
{
"name":"AAE_Basic",
"id":2,
"version":0
},
{
"name":"Role",
"id":18,
"version":0
}
],
"sysAssignedRoles":[
],
"groupNames":[
],
"permissions":[
". . ."
],
"licenseFeatures":[
"RUNTIME"
],
"emailVerified":true,
"passwordSet":true,
"questionsSet":true,
"enableAutoLogin":false,
"disabled":false,
"clientRegistered":false,
"description":"",
"createdBy":1,
"createdOn":"2023-03-10T13:39:56-05:00",
"updatedBy":1,
"updatedOn":"2023-03-13T02:09:38-05:00",
"publicKey":null,
"appType":null,
"routingName":null,
"appUrl":null
}
}
Copy the API response generated token in between the quotations.
Create a POST request for Device Reset and Hit Send button
Method: POST
URI:
https://<ControlRoom>/v2/devices/reset
Headers:
KEY | VALUE |
x-authorization | eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiIxIiwiY2xpZW50VHlwZSI6IldFQiIsImxpY2Vuc2VzIjpbXSwiYW5hbHl0aWNzTGljZW5zZXNQdXJjaGFzZWQiOnsiQW5hbHl0aWNzQ2xpZW50Ijp0cnVlLCJBbmFseXRpY3NBUEkiOnRydWV9LCJpYXQiOjE1NzMxMDc4NzMsImV4cCI6MTU3MzEwOTA3MywiaXNzIjoiQXV0b21hdGlvbkFueXdoZXJlIiwibmFub1RpbWUiOjM2NTc1NjI0OTQ2MzE2MDAsImNzcmZUb2tlbiI6ImNiZjgwZWNkZmU5YmUwYzViOGI2MDk3NmU0ZTI2MTNiIn0.rGYxbS5kKUTxtZhYtRSXpmIHwbf3IwLBIKDEA7odG5uGVAjD55Tv05bYdARx_3-tl1CBg_cDGbwj5FvaBt9u5xKu5W5j3Nur6x3PF62NeB3ZIdxiUPaFBU0Br84mPJMD4_EpwBfbeSVOMH6ngiLtJYhIOtJa0kp4pAAm3mvkuOUELtH8lf3pQf-2Ose2fUAaebDkqiH13SUF1TONAjUQv6Ef_uY0wgq9SjZwKHg9SKUhX3S8PXAJne_ih2QnN8nUE1SXGlkC04eoIvyWpFkM963XEjptc2uvwtVn42MdA4Nd1opD5yijEl9VM92Fe1sPb6_T5-oV-U1Iw0JHiX2-Ug |
Body:
{
"deviceIds": {
"ids": [<Device ID>]
}
}
Let's grab the Device ID from the Control Room,
Log in to the CR
Go to Manage >> Devices >> Click on the Device
- From the URL collect the device id
Example: In the below example 1234 is the device id
https://community.cloud.automationanywhere.digital/#/devices/mydevices/1234/view
The rest API mentioned in Step-3 when run from Postman gives the response "204 no content". This HTTP Status 204 (No Content) indicates that the server has successfully fulfilled the request and that there is no content to send in the response payload body. Hence this means that the request was successful.
- To finish the device reset, visit CR and refresh the page
💡Tips
Reset API can do the following actions for the given device,
Terminate all running executions
Release all usages
Reprocess the queue for the device
As per the JSON format, the '\' is considered an escape character. Therefore, use one more "\" (ie '\' in place of single \) so that it is not considered an escape character.
Conclusion
Hopefully, you found it interesting to learn how to reset an Automation Anywhere device using API in Postman, which can help with resolving issues in BOT execution and resetting a device.
Subscribe to my newsletter
Read articles from Chand Mohammad S directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Chand Mohammad S
Chand Mohammad S
Lead Developer | Technical Blogger | 🌠 ✨ Postman Supernova