Skip to content

Instantly share code, notes, and snippets.

@dpawluk
Created April 8, 2014 22:32
Show Gist options
  • Save dpawluk/10203011 to your computer and use it in GitHub Desktop.
Save dpawluk/10203011 to your computer and use it in GitHub Desktop.
a script to delete many tickets based on ticket id range
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