Hello @Jeremiah Logan
Thanks for reaching out to Automation Anywhere.
You could try passing the token with Headers on the next call with the X-Authorization parameter
@header@{
x-authorization="token received form older call"}
For further assistance please reach us with a Support case and our Engineers shall assist
https://apeople.automationanywhere.com/s/article/How-to-create-a-support-case-in-service-cloud
Thanks, I was able to get the list to work by including the X-Authorization param. I'm now trying to get the bot deployment to work. I can connect, and get both the user ID and the Bot ID, but the deployment fails with a 400 Unauthorized. I think it has something to do with the RunAsUserIDs arraylist:
$sUrl = "<url>/v1/authentication"
$body = @{
'username' = "username"
'password' = "password"
}
$bodyJson = $body | ConvertTo-Json
$Response = Invoke-RestMethod -Method Post -Uri $sURL -Body $bodyJson
$newURL = "<url>/v2/repository/workspaces/private/files/list"
$sessionHeader = New-Object "System.Collections.Generic.DictionaryctString],SString]]"
$sessionHeader.Add('x-Authorization',$Response.token)
$sessionHeader.Add('Accept','application/json')
$type = "application/json"
$newBody = @{
'filter' = @{
'operator' = "substring"
'field' = "name"
'value' = "AA_API_"
}
}
$newBodyJson = $newBody | ConvertTo-Json
$Response2 = Invoke-RestMethod -Method Post -Uri $newURL -Body $newBodyJson -Headers $sessionHeader -ContentType $type
$token = $Response.token
$ID = $Response.user.id
$botID = $Response2.list.Id
$botURL = "<url>/v3/automations/deploy"
$botBody = @{
'fileId' = "8200"
'runAsUserIds' = "n168]"
'poolIds' = ""
'overrideDefaultDevice' = "false"
'callbackInfo' = @{
'url' = "https://callbackserver.com/storeBotExecutionStatusquot;
'headers' = @{
'X-Authorization' = "{{$($token)}}"
}
}
'botInput' = @{
'sInput1' = @{
'type' = "STRING"
'string' = "These values come "
}
'sInput2' = @{
'type' = "STRING"
'string' = "from the API call"
}
}
}
$botBodyJson = $botBody | ConvertTo-Json
$Response3 = Invoke-RestMethod -Method Post -Uri $botURL -Body $botBodyJson
$Response3
Hi @Jeremiah Logan,
Trust you are well.
I'm trying to, build a bot to reset its own AD password and at the same time update the password in the CR.
This must be done in powershell, how where you able to connect to the Control room API using powershell?
I was able to connect to the CR, and manage some items, but have not had time to revisit in a while. Here are some of the things I was able to accomplish:
Authentication to the CR:
https://gist.github.com/JLogan3o13/296395aeee5e332a6934a84276403597/p>
From here I can capture the auth token with $Response.token, or the UUID with $Response.tenantUUID, so I know I am connected successfully. I can also poll the user hive with things like $Response.user.id and $response.user.sysAssignedRoles. I can even list all bots in the CR, or search for one in particular:
<Start with the authentication code above>...
https://gist.github.com/JLogan3o13/4ad71c05374fe029872558ccba2fa845/p>
Again, this is about as far as I got before getting pulled into other projects. Hope it helps you.