7631723

Unable to create a new change through PowerShell/Samanage API.

Discussion created by 7631723 on Jul 9, 2015
Latest reply on Jul 10, 2015 by 7631723
Hello all,

I've been working on some change ticket automation, and have been unable to create a new change using PowerShell and the Samanage API. My script has been included below. I have tried via .json and xml, but have been unsuccessful in both cases and have been receiving an "error: (422) Unprocessable Entity."

Does anyone have any insight into how to potentially resolve this issue?
______________________________________________________________

$creds = Get-Credential EMAIL@DOMAIN.COM
$xmlfile = [xml] @"
<change>
<name>Test</name>
<requester><email>EMAIL@DOMAIN.COM</email></requester>
<state>Closed Completed</state>
</change>
"@
$headers = @{"Accept"="application/vnd.samanage.v1.1+xml"}

Invoke-WebRequest -Uri "https://api.samanage.com/changes.xml" -Body $xmlfile -Credential $creds -ContentType "text/xml" -Headers $headers -Method Post
 
______________________________________________________________

Thanks!

Outcomes