Hi I am trying to get the raw data for an event using the dashboard rest api that Amplitude offers. I am completely new to Amplitude and REST APIs. I have an event that want to group it by two properties and get the raw data for lets say 3 days. The expected output in a csv format should look like below:
" keywords; [Amplitude] User ID"," 2021-06-09"," 2021-06-10"," 2021-06-11",
" vaccine; AhL67nr8JDA","0","0","1",
" important themes; C1VzZXJQcm9ma","0","1","0",
" broadband; agxzfnViZX","1","0","0",
" oklahoma; Y2VyGSC1VzZX","1","1","0"
,where keywords and User ID are the two properties that I group by the data on. I see such a data in the breakdown table in Amplitude UI but don’t know how I can extract this data using the REST API.
If this is a one off thing and you just want the csv output of that chart, then you can just export the csv for that chart to get that format ( which I believe is how you got the csv format here ).
The Dashboard REST API doesn’t give a formatted csv/tabular output as such, but depending on what call you are making to the /api/2/events/segmentation end point, the raw data points returned would be nested as json lists/objects in the series, seriesLabels , seriesCollapsed and xValues keys. You will have to parse and extract these values to create a formatted output of your choice accordingly.
The group by clause for your use case would look something like this -
If this is a one off thing and you just want the csv output of that chart, then you can just export the csv for that chart to get that format ( which I believe is how you got the csv format here ).
The Dashboard REST API doesn’t give a formatted csv/tabular output as such, but depending on what call you are making to the /api/2/events/segmentation end point, the raw data points returned would be nested as json lists/objects in the series, seriesLabels , seriesCollapsed and xValues keys. You will have to parse and extract these values to create a formatted output of your choice accordingly.
The group by clause for your use case would look something like this -
Right, I can not simply have a CSV formatted output using the API and have to convert the JSON to CSV. No problem with that.
The group_bu clause you wrote is what I needed, a question though, can I only have the two types of ‘event’ and ‘user’ properties in the group_by clause? I have another set of properties other than Event Properties and User Properties that is called Amplitude User Properties and need to use that as one of my properties in group_by. So, need something like this:
For non-Amplitude, custom user properties, prepend the user property name with "gp:". "gp:" is not needed for event properties. For using an event property, you can use "type": "event" if you are using it in the group by .
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. You can also create a Guest account below!
If you're a current customer, select the domain you use to sign in with Amplitude.
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. Want to sign up as a guest? Create a Community account.
If you're a current customer, select the domain you use to sign in with Amplitude.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.