This is a guest post from Asif Shaikh, a Lead RPA Consultant with Atos Syntel. If you have an idea for a blog post or tutorial that you think would benefit the Automation Anywhere developer community, let us know at developer@automationanywhere.com.
In this tutorial, we will look at how you can copy Credentials from V11 to Automation360 using Control Room APIs in Postman. Also, we have shared the link (at the end of the article) to the Automation 360 bot which can copy the credentials, if you would like to try it out. This is useful when you have an Automation 360 CR already setup and want to copy over the credentials from V11 CR. Here are the pre-requisites and information required before you can try out this tutorial:
- Basic Knowledge of APIs
- Credential details (Both V11 and Automation 360)
- Familiarity with Automation Anywhere Control Room
Disclaimer: As a security measure, the process will only not copy the passwords stored in the Credential vault, however, the name of the credential and its attributes can be copied over.
Step 1: Authenticating Automation Anywhere V11 CR and generating token: Use the POST method to generate an authentication JSON Web Token
API: {{url}}/v1/authentication
Method: POST
Request parameters: {"apiUsername": "username", "apiPassword": "password"}
Header:Content-Type: application/json
From the API response received, lets save the token in Environment variable “authToken” by entering the following code in the Tests section:
var response = JSON.parse(responseBody);
pm.environment.set("authToken",response.token);
Step 2: Automation Anywhere V11 - Search for Lockers based on the permissions you have and in the response you will get the list of lockers.
API: {{url}}/v2/credentialvault/lockers/list
Method: POST
Request parameters:{ "sort":>], "filter":{"value":"permissions","field":"owner"},"fields":,],"page":{ }}
Header:Content-Type : application/json , X-Authorization : {token from Step 1}
Here is the sample Response received from the API :
{
"page": {
"offset": 0,
"total": 1,
"totalFilter": 1
},
"list":
{
"id": "7",
"name": "Test Locker",
"description": "Locker for production bots",
"createdBy": "7",
"createdOn": "2019-01-15T12:56:15.508Z",
"updatedBy": "7",
"updatedOn": "2019-01-15T12:56:15.508Z",
"version": "0",
"members":
{
"id": "1",
"permissions": e
"participate",
"own",
"manage"
]
},
{
"id": "2",
"permissions": e
"participate",
"own",
"manage"
]
},
{
"id": "7",
"permissions": e
"participate",
"own",
"manage"
]
},
{
"id": "8",
"permissions": e
"participate",
"own",
"manage"
]
}
],
"countOfCredentials": 62
}
]
}
Step 3: Automation Anywhere V11 - Fetch all Credentials and its attributes present using the Locker id.
API: {{url}}/v2/credentialvault/lockers/{LockerID}/credentials (LockerID from Step 2)
Method: POST
Request parameters: None
Header:Content-Type: application/json, X-Authorization : {token from Step 1}
Here is the sample response from the API call:
{
"list": <
{
"id": "18",
"name": "Testing 1 Credential Name",
"description": "Testing 1 Credential Description",
"lockerId": "7",
"ownerId": "7",
"attributes":
{
"id": "73",
"name": "Test Attribute Name",
"description": " Test Attribute Description ",
"userProvided": false,
"masked": true,
"createdBy": "7",
"createdOn": "2019-01-22T09:29:36.017Z",
"updatedBy": "7",
"updatedOn": "2019-01-22T09:29:36.017Z",
"version": "0"
}
],
"createdBy": "7",
"createdOn": "2019-01-22T09:29:36.018Z",
"updatedBy": "7",
"updatedOn": "2019-01-22T09:29:36.121Z",
"version": "1",
"completed": false
}
]
}
Step 4: Automation 360 Authenticate the user
Use the POST method to generate an authentication JSON Web Token (and also save API Key in the configuration file if your control room is setup with the single sign-on and use the API key in your task bot)
API: {{url_A360}}/v1/authentication
Method: POST
Request parameters: {"username": "username", "password": "password", "apiKey": "API from CR"}
Header: Content-Type : application/json
You can see the token in the response as shown above. Save the token into an environment variable by entering the code in the Tests section. Variable authToken_a360 will store the Token which can be used in the subsequent API calls. var response = JSON.parse(responseBody); pm.environment.set("authToken_a360",response.token);
Step 5: Automation 360 - Call Create Credentials API.
Enter the required parameters as shown below to create the Credential in Automation 360 CR.
API: {{url_AA vA360}}/v2/credentialvault/credentials
Method: POST
Request parameters:
{
"name": "Testing 1 Credential Name",
"description": "Testing 1 Credential Description",
"attributes": r
{
"name": "Test Attribute Name",
"description": "Test Attribute Description l",
"userProvided": false,
"masked": false,
"value": "user@automationanywhere.com",
"passwordFlag": false
}
]
}
Header: Content-Type : application/json , X-Authorization : {token from Step 4}
Here is the sample response you will receive from the API call and this will include the Id for the Credentials and their attributes.
{
"id": "177",
"name": "Testing 1 Credential Name",
"description": "Testing 1 Credential Description",
"ownerId": "190",
"attributes": ,
{
"id": "481",
"name": "Test Attribute Name",
"description": "Test Attribute Description l",
"userProvided": false,
"masked": false,
"createdBy": "190",
"createdOn": "2021-09-24T17:12:39.541674800Z",
"updatedBy": "190",
"updatedOn": "2021-09-24T17:12:39.541674800Z",
"version": "0",
"passwordFlag": false
}
],
"createdBy": "190",
"createdOn": "2021-09-24T17:12:39.541674800Z",
"updatedBy": "190",
"updatedOn": "2021-09-24T17:12:39.541674800Z",
"version": "0",
"externalVaultCredentialName": ""
}
If you would like to try out the Automation 360 bot to copy credentials from V11 to Automation 360, use the attachment below.
Conclusion
Hopefully, you enjoyed learning how to copy credentials from your V11 Control Room to Automation 360 CR using the CR APIs. If you would like to learn more about how to use other Control Room APIs, here is the article to guide you with the required information.
Asif Shaikh is a certified RPA Developer with 7+ years of experience in RPA development using Automation Anywhere. He is a self-directed leader with expertise in automating different types of applications and has excellent knowledge of SAP, Automation Anywhere APIs and AWS cloud. When he’s not building bots, you can find Asif on LinkedIn as well as on the forums of the Pathfinder Community.