Skip to content

Instantly share code, notes, and snippets.

@shon
Created February 2, 2015 14:37
Show Gist options
  • Save shon/3ea673fa72319cb38786 to your computer and use it in GitHub Desktop.
Save shon/3ea673fa72319cb38786 to your computer and use it in GitHub Desktop.
It was good waste of time to figure out how to delete a keen.io event preferrably using Python. While I understand keen folks don't like deletes but wish there was better python API to do so.
import json
import requests
API_KEY = ''
PROJECT_ID = ''
COLLECTION_NAME = ''
filters = [{'property_name': 'keen.timestamp', 'operator': 'eq', 'property_value': '2015-02-02T10:20:00.000'}]
resp = requests.delete('https://api.keen.io/3.0/projects/' + PROJECT_ID + '/events/' + COLLECTION_NAME +'?api_key=' + API_KEY + '&filters=' + json.dumps(filters))
print(resp.status_code) # 204
print(resp.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment