Unwatching issues

Hi. I’m in the process of converting our existing issues into JIRA issues using the REST API. Because the API automatically adds the user using the API as a watcher for imported (created) issues, and I only want “real” watchers, I’d like to remove the default watcher after the issue is created.

No matter what I do, neither IssueRestClient.unwatch() nor IssueRestClient.removeWatcher() do anything at all - the default watcher remains.

Is there any way, using the API, to remove a watcher? I will eventually have upwards of 10K issues, and I’d prefer not having to manually (albeit in bulk) remove the default watcher.

FWIW, IssueRestClient.getWatchers() returns the list of watchers, a single item including the user that created the issue. I’ve tried a number of things to no avail, including refreshing (re-reading) the issue before attempting to unwatch the issue.


final URI watcherURI = issue.getWatchers().getSelf();


P.S. The user in question is the JIRA account admin, so certainly has plenty of authority.

Never mind - found the problem. This wasn’t quite the last time I touched the issue in the code, and a subsequent update of the issue (comments) caused the current user to be added again as a watcher.

Removing the current user as a watcher via IssueRestClient.unwatch() at the very end works.


Thanks @bill.somerville for coming back and letting us know the solution.