I am looking at appending a note/worklog/resolution in a ticket via API and have tried using the Put method but this overwrites the note/worklog/resolution. In particular I would like to be able to create readable multi-line notes but appending worklogs and resolutions would also be useful via API for our many scripted tasks (add/remove users etc).
$Input_data = "{""note"": {""description"": ""Phone number for $($adtemp.UserPrincipalName) listed as $($adtemp.telephonenumber)""}}"
$taskData = Invoke-RestMethod -Method post -Uri $("$jobUri/notes") -Headers $header -Body @{'input_data'=$Input_data} -ContentType "application/x-www-form-urlencoded"
works correctly and creates the note in the job with the correct details but if I then run
$input_data = "{""note"": {""description"": ""Computer(s) found in AD listed as used by $($adtemp.userprincipalname))""}}"
Invoke-RestMethod -Method Put -Uri $("$jobUri/notes/$($taskdata.note.id)") -Headers $header -Body @{'input_data'=$Input_data} -ContentType "application/x-www-form-urlencoded"
the note is overwritten completely and the previous description gone. I assume this is expected behaviour for the put method.
Does someone have an example of a PowerShell API request using a multi-line body?