1

Using the Amplitude Dashboard REST API, I am attempting to get a count of all unique times a custom event was triggered with a filter of a custom event property. However I am unable to even get the simplest event segmentation to run, though all other endpoint hits (except Funnels which also use the e event parameter) are working as expected. In other words, my auth is working and I'm able to successfully get data from all the endpoints that don't require the e event parameter.

Here is an example of a constructed endpoint using event segmentation that is as simple as I believe it could possible be and which is failing with a 400 error.

https://amplitude.com/api/2/events/segmentation?e=\{"event_type":"_active"\}&start=20170401&end=20170402

While the call I want to do is ultimately more complex and involves a filter, I'm unable to just get this call which is one of the simplest event segmentation calls possible, considering the e, start, and end parameters are all required.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
st1ph1n
  • 53
  • 7

1 Answers1

3

Try properly percent escaping the e parameter.

https://amplitude.com/api/2/events/segmentation?e=%7B%22event_type%22%3A%22_active%22%7D&start=20170401&end=20170402

Uriah Carpenter
  • 6,656
  • 32
  • 28
  • I was not using curl but Java HttpClient so I needed to escape the characters like you said here. I also had spaces in my `event_type` field because my event had spaces in it. When I use UTF-8 encoding it replaces those spaces with `+` but I need them to be `%20` so I have to go in and replace them, otherwise the call also fails. But sadly that's a little brittle. `encodedEventParameter = URLEncoder.encode(eventParameter, "UTF-8"); encodedEventParameter = encodedEventParameter.replace("+", "%20");` – st1ph1n May 13 '17 at 13:17