Example: Basic code to use Python to Import Events from CSV file to Split organization using Split Admin API.
Environment:
- Python 2.7.15
- requests 2.18.1
How to use:
- Class wrapper for Admin API is:
SplitAPI.py
- Update the source CSV file path and name in Main.py:
- csvFile
- Make sure the csv file is formatted as follows:
event_name,environment_name,traffictype_name,user_name,timestamp
For example:
conversion,Production,account,user99,1566940852000
conversion,Production,account,user94,1566940852000
conversion,Production,account,user95,1566940852000
- The Events are added in a string variable as a JSON array format, the script will format the results returned from CSV file accordingly, for example:
[{
"eventTypeId": "conversion",
"environmentName": "Production",
"trafficTypeName": "account",
"key": "key_user99",
"timestamp": 1555523409000
},
{
"eventTypeId": "page_load_time",
"environmentName": "Production",
"trafficTypeName": "account",
"key": "key_user99",
"value": 0.9,
"timestamp": 1555523409000
}]
Comments
0 comments
Please sign in to leave a comment.