Powershell REST API operations

Powershell REST API operations

After a lot of searching I found the answer to my original question below. Thanks to Marcin in this topic! 

  1. $SDLink = "http://localhost:8080/"
  2. $api="sdpapi/request?"
  3. $format="json"
  4. $APIKey = "<Your API-key>"

  5. $inputData = @{
  6. operation=
  7. @{details=
  8. @{subject="Servicedesk Plus MSP example";
  9. description="Yay! I'am able post a request with PowerShell!";
  10. requester="John Doe";
  11. site="Sample Site";
  12. account="Sample Account"
  13. }
  14. }
  15. } |ConvertTo-Json
  16. $URI=$SDLink+$api
  17. $postParams = @{TECHNICIAN_KEY=$($APIKey);data=$($inputData);format=$($format)}
  18. Invoke-WebRequest -Uri $URI -Body $postParams -Method POST -TimeoutSec 10 
  19. write-host $SDLink


Dear MSP users,

Anyone succesfully managed to use REST API operations with Powershell? If so, do you have a sample script to add and edit a request? Thanks in advance! ;-)

Kind regards,
Kerim Berkeveld

                New to ADSelfService Plus?