Created
April 8, 2014 22:32
-
-
Save dpawluk/10203011 to your computer and use it in GitHub Desktop.
a script to delete many tickets based on ticket id range
This file contains 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
import requests | |
s = requests.Session() | |
s.headers.update({'Content-Type': 'application/json'}) | |
s.auth = ('ADMINEMAIL/token','APITOKEN') | |
y = 1500 #starting ticketid | |
#declare last ticketid here | |
while (y < 24167): | |
array = [x for x in range(y, y+99)] | |
string = str(array).replace('[','').replace(']','') | |
requeststring = "https://SUBDOMAIN.zendesk.com/api/v2/tickets/destroy_many.json?ids=%s" % string | |
r = s.delete(requeststring) | |
y += 99 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment