We help IT Professionals succeed at work.

Powershell and Remedy Force automation

janhoedt
janhoedt used Ask the Experts™
on
Hi,

I d like to handle a ticketing System Remedy Force Powershell based: (to automate stuff) query tickets, tasks assigned to a group, user, create tickets, close etc. There is an api to use
https://docs.bmc.com/docs/remedyforce/201802/en/remedyforce-rest-api-801357497.html

But dont get result out of it. Sales force Online is used. Also dual factor: cert and use/pw
Could you help me, step by step please.

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Global Support Services Engineer
Commented:
Here is what I have:
$uri = "https://login.salesforce.com/services/Soap/u/35.0"
$result = (Invoke-WebRequest $uri -InFile $PSScriptRoot\RemedySoapRequest.xml -ContentType "text/xml" -Method Post)
$xmlResult = $result.Content
#Write-Host $xmlResult

$xpathfilter = "//*[local-name()='sessionId']"
$sessionId = Select-Xml -Content $xmlResult -XPath $xpathFilter
#Write-Host $sessionId

$resturi = "http://na1.salesforce.com/services/apexrest/BMCServiceDesk/Version"
$restHeader = @{ 'Authorization' = "Bearer $sessionId";'Accept' = 'application/json' } 
$restResult = (Invoke-WebRequest $resturi -Method Get -Headers $restHeader)
Write-Host $restResult

Open in new window


I don't have an account so I can't test, but essentially the first web call gets the sessionId and you use this sessionId to make a second web call to the REST interface to do what you need, e.g. query tickets, etc.

I believe you can use this reference for the REST API's to get the info you need.  I just used the "Version" action to get the version.

Author

Commented:
Thanks! Will check soon.

Author

Commented:
Couldn't make it work, but that's probably because we have cert MFA enabled. So can't tell it is NOT working either.
No time to dive deeper into it, so will consider as working.