Solved

Retention cURL on Dashboard Rest Api

  • 15 April 2021
  • 1 reply
  • 46 views

Hello, I've been trying to get the retention using a starting event and return event.
The cURL that i'm using (excluded the auth header): 

https://amplitude.com/api/2/retention?se=\{"event_type":"ce:notification_open_event"\}&re=\{"event_type":"Start%20Session"\}&start=20210412&end=20210415

notification_open_event is a custom event and i'm trying to use the amplitude default event Start Session as well.

the cURL keeps returning 400: Bad Request (Unable to create definition from arguments)

the documentation (https://developers.amplitude.com/docs/dashboard-rest-api#retention-analysis) states that “Full event for the start action. Supports two "event_type" values: "_new" for new users, and "_active" for all users.”. Can it be a custom event as well? If not, what would be an alternative to do the same but with a custom event

Thanks!

icon

Best answer by jarren.patao 16 April 2021, 18:52

Hi @wayzer,

Looks like you're already on your way to making this REST API call so great work thus far! You are able to use custom events as you've described, but the return event would not actually be queried with "Start%20Session". This event is created with the event type = "session_start" so your query should just alter this string to work appropriately! 

It should look a little like this:

https://amplitude.com/api/2/retention?se=\{"event_type":"ce:notification_open_event"\}&re=\{"event_type":"session_start"\}&start=20210412&end=20210415

Hope this helps!

View original

1 reply

Userlevel 2

Hi @wayzer,

Looks like you're already on your way to making this REST API call so great work thus far! You are able to use custom events as you've described, but the return event would not actually be queried with "Start%20Session". This event is created with the event type = "session_start" so your query should just alter this string to work appropriately! 

It should look a little like this:

https://amplitude.com/api/2/retention?se=\{"event_type":"ce:notification_open_event"\}&re=\{"event_type":"session_start"\}&start=20210412&end=20210415

Hope this helps!

Reply