Avaya Support Forums  

Go Back   Avaya Support Forums > Small and Medium Business Communications

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 01-14-2021, 09:32 AM
drueneuve drueneuve is offline
Aspiring Member
Join Date: Dec 2020
Posts: 2
drueneuve has 10 reputation points
Default IPO 11 REST API with Powershell

Hi all
Does anybody have a sample code to run GET methode with powershell
I succed with authentication but the GET return error 401 unauthorized
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$uri = "https://<IPAddress_IPO>:7070/WebManagement/ws/sdk"
$authente = "/security/authenticate"
$IPAdress = "/admin/v1/provisionIPAddress"

$Text = "SDKUser:password"
$Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
$credentials = [Convert]::ToBase64String($Bytes)

$headers = @{                            
    "X-User-Client" = "Avaya-WebAdmin"
    "X-User-Agent" = "Avaya-SDKUser"
    "Content-Type" = "application/xml"
    "Authorization" = "Basic " + $credentials
    "Host" = "<IPAddress_IPO>:7070"

$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
Result :
Status : 1
Error :
$response2 = Invoke-restmethod -method GET -Uri ($uri+$IPAdress) -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
Result :
Status : 0
Error : 401:UnAuthorized
I have check that $tokenSDK contain cookies JSESSIONID, I don't understand how to maintain the session !

Last edited by drueneuve; 01-14-2021 at 09:36 AM.
Reply With Quote

rest api

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 02:10 PM.

This Forum is provided solely for the use and convenience of Avaya customers and partners. Use of the Forum is subject to the Terms and Use and Privacy Statement found at www.avaya.com. No other use is permitted. The Forum including all content posted is “AS IS” and Avaya expressly disclaims all warranties and/or guarantees as to its accuracy, reliability, usefulness, quality or non-infringement of intellectual property. Avaya reserves the right to remove any content posted on the Forum at any time and for whatever reason.

Avaya will not be liable for any content posted on this Forum, including, without limitation, any errors or omissions or for any losses or damages of any kind incurred as a result of use or reliance on any content, regardless of its origin.

You expressly understand and agree that you assume all risks associated with use or reliance on this content.