Updating Service Record via REST API

Hi Guys,

I'm fairly new to SysAid and have been getting to grips with using Powershell to retrieve and update service records. I've been successful in the former, however when attempting to update records I am running into an issue.

The script runs without error and viewing the ticket history in the browser shows that it has been updated, but the actual fields don't appear to update at all.

Example below:

$body = '{"id":"123456","info":[{"key":"priority","value":"0"}]}'
Invoke-restmethod -uri https://companynamehere.sysaidit.com/api/v1/sr/123456 -WebSession $session -method put -ContentType application/json -body $body

The scenario is that we have a number of old tickets that have an out of date priority set and we need to change them to a new one before we disable or delete the invalid priority. Has anyone else had this issue and been able to overcome it?

Any help appreciated, thanks.
Managed to find the solution myself to this one.

You have to update the whole key, not just the 'value' part, so instead of:

$body = '{"id":"123456","info":[{"key":"priority","value":"0"}]}'

I changed it to:

$body= '{"id":"123456","info":[{"key":"priority","value":"0","valueClass":"","keyCaption":"Priority","valueCaption":"P5"}]}

The change then displayed correctly in the history:

Incident #123,456 priority has been changed to P5