Search the Community
Showing results for tags 'rest api'.
Found 1 result
I have been successfully creating tickets in CA Service Desk using Powershell for a couple years now, but I have been tasked with figuring out how to add an attachment to the ticket. They way I am doing it currently is, once I have the $accesskey: $URIString = "http://$servername:8050/caisd-rest/cr" $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("X-AccessKey", $accesskey) $headers.Add("Accept", "application/xml") $headers.Add("Content-Type", "application/xml; charset=UTF-8") $headers.Add("X-Obj-Attrs" , "ref_num") $body = "<cr><group COMMON_NAME=`"Security Admin`"/><summary>`"Test Ticket - Please Ignore`"</summary><requested_by COMMON_NAME=`"AutomationReview, UserAccess`"/><customer COMMON_NAME=`"AutomationReview, UserAccess`"/><description>`"Test Ticket - Please Ignore`"</description></cr>" $b = Invoke-RestMethod -Method POST -Uri $UriString -Headers $headers -body $body This works great, but I can't figure out how to add an attachment. I tried adding "<attachment>`"C:\temp\empID.txt`"</attachment>" to the middle of the body, and while that didn't throw any errors, it didn't seem to do anything. Can anyone point me in the right direction?