I am trying to add watchers to an issue using rest API in python below is my code
url = 'https://my-domain.atlassian.net/rest/api/3/issue/%s/watchers?accountId=%s' % (
issue_id, userid)
list_watchers_url = 'https://my-domain.atlassian.net//rest/api/3/issue/%s/watchers' % issue_id
username = 'user-email'
password = '<API_TOKEN>'
add_watcher = requests.post(url, auth=(username, password))
watchers_list = []
watchers_list_resp = requests.get(list_watchers_url,
auth=(username, password))
for i in watchers_list_resp.json()['watchers']:
watchers_list.append(i['displayName'])
print(watchers_list)
Since I use my email and API key, it only adds me as a watcher.
I am unable to set anyone else.
user_id in the URL is the account id from Atlassian and not email or name.
I also used the jira-python library and it bombs worse than this.
watcher = JIRA::Resource::Watcher.new(client, issue: issue)
watcher.save!(user_id)
worked via jira-ruby gem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.