[Dashboard REST API] Properly Use "Group By" Clause
Hello Amplitude,
I’m trying to get data via the Dashboard REST API and was able to successfully pull data via the event segmentation endpoint with an event_type and filters. However, for my next chart I need to use a group_by and I’m struggling to properly format the request for my query. Can someone please provide some guidance on how to properly structure complex queries?
For reference, I’m quite confused by the documentation, since it appears there are three different areas where a group_by can be specified.
The first place it mentions is as a parameter next to the event itself:
The second place is as a parameter within the full event:
The third place is as a parameter within the event segmentation section:
Page 1 / 1
Hey @pattsao From what I understand, the event segmentation chart end point takes in the following parameters depending on where you want to apply the group by :
If you want to apply the group by on the actual event ( similar to using group by in the Events Module ) , then you should be including that as part of the event parameteras a key as the documentation mentions ( second place ). Here you can specify either a user property or an event property on that specific event by using type either as “event” or “user”
If you want to apply the group by across all users ( similar to applying group by in the Segmentation Module) , then you should be including it as a parameter within the event segmentation ( third place ). Here you can input only a valid user property.
I normally create dictionaries in Python to format these requests. Let me know if you need further help with this.
Hope this helps!
Hello @pattsao! Thanks for your question. Happy to help.
To pull event data via the Dashboard REST API you would first want to navigate to the section of the documentation which references your desired endpoint. You can do so by clicking the name of the desired endpoint in the Table of Contents list on the right-hand side of the page:
Within the section for your desired endpoint there will be parameters for how to pull data with a group_by applied. For example, if you wanted to send a request to pull data with a group_by for the Event Segmentation end point the parameters are as follows:
There are also example requests contained within the section pertaining to your desired endpoint:
For example, the proper format for your request using the Event Segmentation endpoint should be formatted like so,
I hope this is helpful! Let us know if you have questions.
Thanks for the response! It was helpful to think of each part of the query as corresponding to different parts of the Amplitude UI. Really appreciate the help!
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.