Skip to content

Instantly share code, notes, and snippets.

@mperesson
Created April 25, 2019 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mperesson/d872ddcdb7e12559d7e84c4693c928ae to your computer and use it in GitHub Desktop.
Save mperesson/d872ddcdb7e12559d7e84c4693c928ae to your computer and use it in GitHub Desktop.
Kayako API remove spam
import requests
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('email', 'password')
while True:
r = requests.get('https://COMPANY.kayako.com/api/v1/search?fields=id&query=QUERY&offset=0&limit=30&resources=CONVERSATIONS', auth=auth)
ids = []
j = r.json()
if len(j['data']) == 0:
break
for data in j['data']:
ids.append(str(data['id']))
print(ids)
trash_url = 'https://COMPANY.kayako.com/api/v1/cases/trash?ids={}'.format(','.join(ids))
requests.put(trash_url, auth=auth)
print('trashed')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment