What post data is required for Add watcher via REST API?

Hi
Hope all are well?
I searched but the information is a little convoluted. I am trying to implement this https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-watchers/#api-rest-api-3-issue-issueidorkey-watchers-post in our system. What is the format of the post data required for the account ID of the watcher to add?
“application/json string” does not quite help …
Thank you
Yatish

Hi Yatish,

The endpoint can only add one watcher at a time, and the body is just the account id in quotes, e.g.

"5b10ac8d82e05b22cc7d4ef5"

Hope this helps :slight_smile:
Victor

Thank you @victor

The problem I am having is that I am consistently getting back “No POST Data Provided”.

I have tried sending the Acc Id as a string, a JSON with value = the acc id, email address, and a few different formats to no succuess unfortunately.

Please advise?
Yatish

Hi Yatish,

I can’t say for what runtime you are using for your script but from Postman, my generated code is:

curl --location --request POST 'https://example.atlassian.net/rest/api/2/issue/TEST-123/watchers' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <base64-username-token>' \
--data-raw '"5b10ac8d82e05b22cc7d4ef5"'

The request body is a json string (including " quotes) at the root.

@victor Thanks for the response.

I have managed to get this working. I am using the REST API directly from a script. I was adding the data as just the acc Id and not the acc Id in quotation marks. It is a bit odd that that was required and that was the response given.

Thanks again