Created
March 23, 2017 11:19
-
-
Save hfs/d5db88cbff1f6a4471f8399389ca91e0 to your computer and use it in GitHub Desktop.
JIRA: Unwatch all issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import requests | |
JIRA_URL = 'https://JIRA base URL' #Fill in your JIRA Root | |
WebSession = requests.Session() | |
WebSession.auth = ('username','password') #JIRA Credentials go here, Optionally use Base64 Encode/Decode | |
WebParams = {'jql':'watcher = currentUser()', 'fields':'key,summary', 'maxResults':'9999'} #You can use basically any JIRA search query here in the JQL parameter | |
WatchList = WebSession.get(JIRA_URL + '/rest/api/latest/search', params=WebParams) | |
WebParams = {'username': 'username'} #Insert User Name of watcher to delete here, probably yours | |
for k in WatchList.json()['issues']: | |
print 'Removing Watcher ' + WebParams['username'] + ' from issue ' + k['key'] + ': ' + k['fields']['summary'] | |
WebSession.delete(JIRA_URL + '/rest/api/latest/issue/'+k['key']+'/watchers', params=WebParams) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment