You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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?
You're using an old doc. Cloud instances deprecated username. Therefore, you should use accountId if you want to add watchers to an issue. See this official doc for an example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Prince NyecheHey, by any chance, do you know how to deal with the authorization issues? I reworked the code, and now I'm getting 403 (not enough permissions), even though I'm admin on the project in question, and also explicitly added myself to the permission schema, 'manage watchers' section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you able to edit the issue field? Check if you have permission for that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Prince Nyeche i am trying to use the updated doc and i am not able to get accountId param. Many people mention using Find users api and when i do that i only get jira key and not account id. also i tried groupuserpicker api - even this only gives jira key and not accountId. any idea why this would be happening?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the searchUser API to return the account of any user within your environment. You have to parse the output to get the accountId key value. An example is shown on the docs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.