Hi :)
I have been poking around with the V2 API, and are currently having issues with the Watcher part.
The Jira Cloud platform REST API (atlassian.com)
If i execute this code, then the account that have logged in are added as a watcher - just as described in the documentation:
Invoke-RestMethod -Uri "https://company.atlassian.net/rest/api/2/issue/Ticket-ID/watchers" -Headers $Headers -Method POST -ContentType "application/json"
But i want to specify another user, based on that users AccountID - so i came up with this:
$Body = @{
accountId = '123-456-789' #This part is redacted
} | ConvertTo-Json
Invoke-RestMethod -Uri "https://company.atlassian.net/rest/api/2/issue/Ticket-ID/watchers" -Headers $Headers -Method POST -ContentType "application/json" -Body $Body
I have even tried with just just having body as a string - $body = "123-456-789"
Both of these give an error 400.
How should the body look, for this to work?