Created
November 30, 2015 14:14
-
-
Save StevenMMortimer/9adf89186b52f9bb43e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# deleting tracking events based on a filter | |
# this example deletes any "simple_tracking" events with an ipdetail.ip equal to 777.888.99.00 within the last 7 days | |
curl "https://api.keen.io/3.0/projects/{project_key_goes_here}/events/simple_tracking?filters=%5B%7B%22property_name%22%3A%22ipdetail.ip%22%2C%22operator%22%3A%22eq%22%2C%22property_value%22%3A%22777.888.99.00%22%7D%5D&timeframe=this_7_days" \ | |
-H "Authorization: {secret_key_goes_here}" \ | |
-X DELETE | |
# deleting between two dates | |
# this uses the R software to convert the json string to the URL encoding as seen in the curl command | |
str <- '[{"property_name":"app_name","operator":"eq","property_value":"my-app"}, {"property_name":"keen.created_at","operator":"gt","property_value":"2015-10-10T00:00:00-0400"}, {"property_name":"keen.created_at","operator":"lt","property_value":"2015-10-09T09:00:00-0400"}]' | |
gsub('-', '%2D', URLencode(str, reserved = T)) | |
curl "https://api.keen.io/3.0/projects/{project_key_goes_here}/events/simple_session_tracking?filters=%5b%7b%22property_name%22%3a%22app_name%22%2c%22operator%22%3a%22eq%22%2c%22property_value%22%3a%22loco%2Drevenue%2Dpotential%22%7d%2c%20%7b%22property_name%22%3a%22keen.created_at%22%2c%22operator%22%3a%22gt%22%2c%22property_value%22%3a%222015%2D10%2D10T00%3a00%3a00%2D0400%22%7d%5d" \ | |
-H "Authorization: {secret_key_goes_here}" \ | |
-X DELETE | |
# emailing a report | |
$ export [email protected] | |
curl https://api.keen.io/3.0/projects/{project_key_goes_here}/queries/count \ | |
-H "Authorization: {secret_key_goes_here}" \ | |
-H 'Content-Type: application/json' \ | |
-d "{ | |
\"event_collection\": \"simple_session_tracking\", | |
\"timeframe\": { | |
\"start\": \"2015-10-08T00:00:00-0400\", | |
\"end\": \"2015-10-09T09:00:00-0400\" | |
} | |
\"email\": \"EMAIL_ADDRESS\" | |
}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment