I'm working with a PowerShell script to interact with Incidents, Tasks and Comments using the REST API. So far Incidents and Tasks have been fairly straightforward, but Comments are giving me grief.
It seems the sticking point I'm trying to solve is the "user_id" property in the request body. The doc says it can be a "number" or "string" and the example shows "1" (number one in quotes). I assume that should refer to an actual User account object? I have a user that incidents are assigned to, but for Updating Comments, it doesn't seem to like the "name", "email" or "id" property of a user. It just throws "Request Not Acceptable". For new Comments, it throws a different error but adds the comment with a null user_id. Reference: apidoc.samanage.com/
$body = @{ comment = @{ body = "My Comment" is_private = $true user_id = "" # <== what should go here? } } | ConvertTo-Json $url = "https://api.samanage.com/incidents/123456789/comments" # incident <id> inserted Invoke-RestMethod -Uri $url -Method POST -ContentType "application/json" -Headers $headers -Body $body # adds comment but user property is empty