How do I export users that triggered an event with a certain parameter via the API
The only way to extract the users that triggered an event with a certain parameter, is to extract it from the sessions data, which you can export through the exportData API call.
The data is large, as it contains the full sessions data, however, you can define periods of the export, where you can just extract the period of interest and then extract the data from the generated exports.
The export can be formatted in JSON and in CSV format, which makes it easily readable and processable.
Here is a useful article on the usage and best practices of the exportData API call: https://docs.leanplum.com/reference#get_api-action-exportdata
And here is a workflow that I can suggest, which I think, would minimize the amount of data dowloaded and get just the data of interest:
- Export the data for the desired period, by using the exportData API call, however, instead exporting it in json format, go ahead and put csv in the exportFormat parameter.
- After you execute the API call, you will get as a response a jobId.
- Now in order to get your export results, just execute the API call getExportResultsand place the jobId as a parameter of that call (please refer to the following article for more information on the getExportResults API call: https://docs.leanplum.com/reference#get_api-action-getexportresults)
- The csv format will export the event and parameter data in different CSV files (whose number for each one, will vary on the size of the data)for:
- output sessions
- output experiments
- output states
- output events
- output event parameters
- output user attributes
- Now you can just download the event parameters and events data.
- The event parameters file will be quite smaller than the events data and it will have only 3 columns:
eventId - the unique Id of the triggered event
name - the name of the parameter
value - value of the parameter
- Now you can just select the parameters of interest and match them by unique Id to the data in the events export CSV.