Solved

Bad Request error on Event Segmentation

  • 28 April 2021
  • 2 replies
  • 72 views

Badge

Hello!!

 

I’m facing problems when calling Event Segmentation API. I always get error 400 Bad Request. I have read this can be related to input JSON format. 

I’ve checked it and see no problems. I’m trying to make a curl call with only custom event name and dates. This is my call

curl -u XXXXXXXXX:XXXXXXXXX "https://amplitude.com/api/2/events/segmentation?e=\{\"event_type\":\"ce:Promoted%20Product%20Clicked\"\}&start=20210426&end=20210427"

 

As I’m on Windows 10, I need to put slashes to escape double quotes.

I hope you can help me finding the problem.

 

Thank you so much!!!

Kind regards

Israel

icon

Best answer by Denis Holmes 29 April 2021, 15:49

Hello Israel,

I can see you’re enquiring as to why your API call isn’t working. I believe the issue has to do with the parameter of ce that you have after event type “ce:”. The ce parameter is used for custom events. I have looked into the backend and I can see that the event “Promoted Product Clicked” is not a custom event but a regular event. In order to get your API to work, I would suggest removing the ‘ce:’ so that it has the following format ;

curl -u API_KEY:SECRET_KEY "https://amplitude.com/api/2/events/segmentation?e=\{\"event_type\":\"Promoted%20Product%20Clicked\"\}&start=20210426&end=20210427"

I hope this helps and you should be able to get it to work once the ce: is removed from your original call!
Have a great day!

View original

2 replies

Userlevel 3
Badge +2

Hello Israel,

I can see you’re enquiring as to why your API call isn’t working. I believe the issue has to do with the parameter of ce that you have after event type “ce:”. The ce parameter is used for custom events. I have looked into the backend and I can see that the event “Promoted Product Clicked” is not a custom event but a regular event. In order to get your API to work, I would suggest removing the ‘ce:’ so that it has the following format ;

curl -u API_KEY:SECRET_KEY "https://amplitude.com/api/2/events/segmentation?e=\{\"event_type\":\"Promoted%20Product%20Clicked\"\}&start=20210426&end=20210427"

I hope this helps and you should be able to get it to work once the ce: is removed from your original call!
Have a great day!

Badge

Hello Israel,

I can see you’re enquiring as to why your API call isn’t working. I believe the issue has to do with the parameter of ce that you have after event type “ce:”. The ce parameter is used for custom events. I have looked into the backend and I can see that the event “Promoted Product Clicked” is not a custom event but a regular event. In order to get your API to work, I would suggest removing the ‘ce:’ so that it has the following format ;

curl -u API_KEY:SECRET_KEY "https://amplitude.com/api/2/events/segmentation?e=\{\"event_type\":\"Promoted%20Product%20Clicked\"\}&start=20210426&end=20210427"

I hope this helps and you should be able to get it to work once the ce: is removed from your original call!
Have a great day!

It worked!!

Thank you so much, I didn’t understand the custom event type so I was calling with the ce: prefix. 

Have a great day Denis!!

Reply