Hi all
I'm trying to query IPO 11 REST API with a powershell script but I'm stuck on an error 401:unauthorized !
This is my test script
Status : 1
Error :
Status : 0
Error : 401:UnAuthorized
It looks that I'm correctly authenticated in the first request and session info are passed in $tokenskd otherwise I got an error 461:SessionTimeout
Thanks for reading.. and more for help
David
I'm trying to query IPO 11 REST API with a powershell script but I'm stuck on an error 401:unauthorized !
This is my test script
Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$uri = "[URL unfurl="true"]https://<serveur>:7070/WebManagement/ws/sdk"[/URL]
$authente = "/security/authenticate"
$huntgroups = "/admin/v1/huntgroups?ipaddress=<IP_Solution_node>"
$Text = "SDKUser:password"
$Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
$credentials = [Convert]::ToBase64String($Bytes)
#$credentials
$headers = @{
"X-User-Client" = "Avaya-WebAdmin"
"X-User-Agent" = "Avaya-SDKUser"
"Content-Type" = "application/xml"
"Authorization" = "Basic " + $credentials
}
$response1 = invoke-restmethod -method GET -Uri ($uri+$authente) -sessionvariable tokenSDK -Headers $headers -SkipCertificateCheck
write-host "Status : " $response1.response.status
Write-host "Error : " $response1.response.data.ws_object.SMAError.error.error_code
Error :
Code:
$response2 = Invoke-restmethod -method GET -Uri ($uri+$huntgroups) -Headers $headers -WebSession $tokenSDK -SkipCertificateCheck -MaximumRedirection 0
write-host "Status : " $response2.response.status
Write-host "Error : " $response2.response.data.ws_object.SMAError.error.error_code
Error : 401:UnAuthorized
It looks that I'm correctly authenticated in the first request and session info are passed in $tokenskd otherwise I got an error 461:SessionTimeout
Thanks for reading.. and more for help
David