Situation
After successfully performing a bulk import into Zendesk....I needed to clear out all the accounts. I had to run this process multiple times as it appears to only return a subset of the users that matched the criteria.
Create text file full of end-users
curl -v -u {email-address}:{password} https://{company}.zendesk.com/api/v2/users/search.json?role="end-user" > zd_end-users.txt
Python script to delete all users in a text file
#!/usr/bin/python
import os
import json
json_data = open('zd_end-users.txt')
data = json.load(json_data)
for user in data['users']:
os.system("curl -v -u {email-address}:{password} https://{company}.zendesk.com/api/v2/users/%s.json -X DELETE" %user["id"])
json_data.close()
References
http://developer.zendesk.com/documentation/rest_api/introduction.html