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?

2 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
September 29, 2017

Go to Admin -> Roles and remove the default users from the roles.

0 votes
Peter DeWitt
Community Champion
September 29, 2017

Marcus, it sounds like you need two separate security schemes for these projects.  I recommend creating a new security group for each project and assigning those security groups the correct permissions for the two new schemes you created.  Add specific users to each group and they will only have access to the projects they are supposed to have access too.

Marcus Mietz
September 29, 2017

Would I need to create an issue security scheme for every client we'll work with or will something along the lines of

  • "Company Internal" for every associate of our company
  • "External Client" for every client

do the trick?

Or are we not talking issue security but rather permissions?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events