Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Add Watchers to an Issue?

Denis Shvetsov
August 17, 2022

Hello. So, I'm trying to add a particular person as a watcher to a number of issues via API, but it doesn't work.

According to this page https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/issue-addWatcher, (the `example` there is exceptionally helpful, btw), I'm supposed to send POST request to `/rest/api/2/issue/{issueIdOrKey}/watchers` with a `username` for a parameter. However, when I do that, my own user gets added to watchers, not the desired user that I send in params. I still get 204, which is a success code here.

URL I'm using:

('https://company.atlassian.net/rest/api/2/issue/issue_key/watchers', auth=auth, headers=headers, params=params)
headers = {
"User-Agent": "dummyValue",
"X-Atlassian-Token": "no-check",
"Accept": "application/json",
"Content-Type": "application/json",
}

params (with the email of the desired user)

{"username": "JoeSmith@company.com"}

What am I doing wrong?

P.S.: I'm kinda confused by the 'username' entity. When I get a user object via API, it has 'emailAddress', 'accountId' and 'displayName' parameters, - but not a `username`. What's up with that?

1 answer

0 votes
Peter Seider
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 28, 2017

I have the same issue. This was working just fine until yesterday.  Jira support logged it as a bug JRACLOUD-67631

Also noted that ~ is marked as an unsupported operator for function currentUser() see https://confluence.atlassian.com/jiracoreserver073/advanced-searching-functions-reference-861257222.html

Cora Mayo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 28, 2017

Thank you for the information Peter. Much appreciated!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events