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

1 accepted

0 votes
Answer accepted
Andy Heinzer
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.
October 1, 2018

I would recommend starting by checking out the Jira Sizing Guide, this can be helpful to understand what kind of resources we expect Jira to have given the size of your environment.  With this info, it might be necessary to also follow Increasing JIRA application memory.

Plugin timeouts like these tend to happen because the server is overloaded or under-resourced.   Usually this happens because of insufficient RAM, or trying to use a system with only a single CPU core.  It's possible that you could have tried to start Jira at one time, and if the system was low on available memory, a plugin in Jira could fail to load on startup.  If this happens, it is possible that Jira can mark plugins as being disabled in the database with a flag.  You can check for these via sql with a command such as

select * from pluginstate;

If all your plugins are enabled, then this table will be blank, but if you have any entries in there, with the values of 'false' for the 'pluginenabled' field, that plugin won't be loaded when Jira starts up.   This will list all user plugins and system plugins alike.   If you can get Jira started, you could also use the UPM manager in Jira to look for disabled plugins and try to reenable them this way.

It is possible that you might have already increased your resources to Jira, but a problem like this can continue until you clear this database entry that flags this system plugin as being disabled.

Yay N' Stuff
October 2, 2018

Hi Andrew,

Thank you for getting back to me :)

There were a whole heap of user installed plugins that were no longer used, I uninstalled those and the problems seemed to go away on its own, its weird...

Was the missing service dependencies in that error message I posted anything to be concerned about?

Thanks Again

Andy Heinzer
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.
October 2, 2018

Not really, it just means that there is a certain set of libraries used for creating sample projects (projects with some basic issues and generic descriptions, etc), and without the welcome plugin in that version, you couldn't use that specific functionality in Jira.

Suggest an answer

Log in or Sign up to answer