07-12-2018 12:37 PM - edited 03-17-2019 01:11 PM
I can read the information I would like but cannot seem to update it.
Here I read successfully.
$MyCreds = Import-Clixml -LiteralPath $credfile
$request = @"
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5">
<soapenv:Header/>
<soapenv:Body>
<ns:getPhone sequence="?">
<name>SEP40CE243F3258</name>
</ns:getPhone>
</soapenv:Body>
</soapenv:Envelope>
"@
$result = Invoke-RestMethod -Method Post -Uri "https://$CUCM`:8443/axl/" -Headers @{'Content-Type'='text/xml';'SOAPAction'='CUCM:DB ver 11.5'} -Body $request -Credential $MyCreds
# Output result
$r = $result.Envelope.Body.getPhoneResponse.return.phone
$adminuser = $r.SelectSingleNode("//adminUserId")."#text"
$adminpwd = $r.SelectSingleNode("//adminPassword")."#text"
Write-Host $adminuser / $adminpwd
*************************************
and it returns the adminuser/pwd successfully.
This is the update script.
$MyCreds = Import-Clixml -LiteralPath $credfile
$request = @"
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5">
<soapenv:Header/>
<soapenv:Body>
<ns:updatePhone>
<uuid>{936E5CEC-BE41-8657-900D-36DE91F80E45}</uuid>
<adminUserId>serviceadmin2</adminUserId>
</ns:updatePhone>
</soapenv:Body>
</soapenv:Envelope>
"@
$result = Invoke-RestMethod -Method Post -Uri "https://$CUCM`:8443/axl/" -Headers @{'Content-Type'='text/xml';'SOAPAction'='CUCM:DB ver 11.5'} -Body $request -Credential $MyCreds
# Output result
$result.Envelope.Body.updatePhoneResponse.return
And I receive a 400.
Thank you
Solved! Go to Solution.
07-13-2018 09:40 AM
It is resolved. I needed a few more elements embedded.
<soapenv:Header/>
<soapenv:Body>
<ns:updatePhone>
<uuid>{936E5CEC-BE41-8657-900D-36DE91F80E45}</uuid>
<vendorConfig>
<AdminLoginDetails>
<adminUserId>serviceadmin2</adminUserId>
</AdminLoginDetails>
</vendorConfig>
</ns:updatePhone>
</soapenv:Body>
</soapenv:Envelope>
07-13-2018 09:40 AM
It is resolved. I needed a few more elements embedded.
<soapenv:Header/>
<soapenv:Body>
<ns:updatePhone>
<uuid>{936E5CEC-BE41-8657-900D-36DE91F80E45}</uuid>
<vendorConfig>
<AdminLoginDetails>
<adminUserId>serviceadmin2</adminUserId>
</AdminLoginDetails>
</vendorConfig>
</ns:updatePhone>
</soapenv:Body>
</soapenv:Envelope>
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide