Solved

Bad Request error on Event Segmentation

  • 28 April 2021
  • 6 replies
  • 440 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

View original

6 replies

Userlevel 6
Badge +8

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!!

Badge

Hi @Denis Holmes i also had similar issue when trying to call event segmentation 

I am trying to call this out

 

This is my url with params

https://amplitude.com/api/2/events/segmentation?e={"event_type":"identifai_register","filters":[{"subprop_type":"event","subprop_key":"response.message","subprop_op":"is","subprop_value":["Successfull%20Register%20New%20Account"]}],"group_by":[{"type":"event","value":"user_profile_data.company"},{"type":"event","value":"user_profile_data.email"}]}

 

I hit via postman and keep getting HTTP 400: Bad Request (Unable to create definition from arguments)

 

Thank you!

BR,

Almira

Userlevel 6
Badge +8

Hi @almira ,

 

Thanks for commenting! Would you be so kind as to create a new community Question for this and then one of the team will pick it up and answer? Thank you!

I would also ensure that all the names you are putting on are the original names and not changed in your org. Use the original names if there are any. But if you start a new question, one of the team members will pick it up and investigate. Let me know when you post it, thanks!

 

Kind Regards,
Denis

Badge

Hi @almira ,

 

Thanks for commenting! Would you be so kind as to create a new community Question for this and then one of the team will pick it up and answer? Thank you!

I would also ensure that all the names you are putting on are the original names and not changed in your org. Use the original names if there are any. But if you start a new question, one of the team members will pick it up and investigate. Let me know when you post it, thanks!

 

Kind Regards,
Denis

Hi Denis, Thanks for replying

I do create new community Question. Here it is 

 

 

Userlevel 6
Badge +8

Thank you @almira ! Someone will pick up the ticket as soon as they can and answer your question. We are currently dealing with high ticket volumes, just as a heads up! 

Reply