How to get counts for multiple events from Amplitude REST API (segmentation)

126 views Asked by At

I am trying to build event object for requesting segmentation for specific events.
I'm using this guide in the docs: https://www.docs.developers.amplitude.com/analytics/apis/dashboard-rest-api/#event-format-example

However I cannot figure out what to do when the property I'm goth filtering by AND grouping by is actually event name.

(equivalent to this setting:) enter image description here

Here is the object I built, but it is not working:

{
    "event_type": "_all",
    "filters":
    [
        {
            "subprop_type": "event",
            "subprop_key": "Event Name",
            "subprop_op": "is",
            "subprop_value":
            [
                "event1",
                "event2"
            ]
        }
    ],
    "group_by":
    [
        {
            "type": "event",
            "value": "Event Name"
        }
    ]
}

I'm assuming something is wrong with 'subgroup_key' in filters and 'value' in group_by? But I cannot find instructions for what to do in this case

1

There are 1 answers

0
yulGM On

Found the setting, in case anyone else will be looking for it: in the API the property to get event name is event_type_value.

so the call that worked is:

{
    "event_type": "_all",
    "filters":
    [
        {
            "subprop_type": "event",
            "subprop_key": "event_type_value",
            "subprop_op": "is",
            "subprop_value":
            [
                "event1",
                "event2"
            ]
        }
    ],
    "group_by":
    [
        {
            "type": "event",
            "value": "event_type_value"
        }
    ]
}