Created
May 21, 2019 14:00
-
-
Save priteshgudge/728cbb47b07cae9aa4caf3c1d1f65753 to your computer and use it in GitHub Desktop.
Clever tap event count api
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
import requests | |
import json | |
headers = { | |
'X-CleverTap-Account-Id': 'PPPPPPPP', | |
'X-CleverTap-Passcode': 'DDDDDDDD', | |
'Content-Type': 'application/json', | |
} | |
data = {"event_name":"App Launched", | |
"from":20190501,"to":20190503, # By using dateime in python | |
"common_profile_properties": { | |
"geo_fields": [ | |
[ | |
"India", | |
"Maharashtra", | |
"Aurangabad" | |
], | |
[ | |
"India", | |
"Maharashtra", | |
"Pune" | |
], | |
] | |
}} | |
response = requests.post('https://api.clevertap.com/1/counts/events.json', headers=headers, data=json.dumps(data)) | |
req_id = response.json()['req_id'] | |
count_response = requests.get("https://api.clevertap.com/1/counts/events.json?req_id={}".format(req_id),headers=headers) | |
count = count_response.json()['count'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment