API connection problem

I’m having a problem with a connection to the Mixpanel API for Track Events (Events)

Their documentation shows that the body of the json sent to the API should show:

curl --request POST
–url https://api-eu.mixpanel.com/track
–header ‘Accept: text/plain’
–header ‘Content-Type: application/x-www-form-urlencoded’
–data 'data={
“event”: “Signed up”,
“properties”: {
“distinct_id”: “00BA7F56-6834-4F83-9C00-F779161BCC75”,
“token”: “af06a617436f32bd0873f494d62b9b7c”

I have tested this connection on that page and it sends the event data to my mixpanel.

I have created an API connection in business logic, the logic is:

When I test this or invoke it with UI Builder, I get a 200 return but with a 0 code:

The Mixpanel documentation says:


If present and equal to 1, Mixpanel will respond with a JSON Object describing the success or failure of the tracking call. The returned object will have two keys: status, with the value 1 on success and 0 on failure, and error, with a string-valued error message if the request wasn’t successful. This is useful for debugging during implementation.

I think I am having a problem creating the body section of the JSON in the right way, I’ve tried several different structures but keep getting the 0 code return.

Any help much appreciated. Thanks!

Hi Luc,

A few things to try:

  1. Add the required headers (Accept and Content-Type)
  2. Looks like the body needs to be an object with the property data that contains the object you’re creating and passing as body now.

Please give it a try and let us know if it helped.


@mark-piller thank you.

When I try with the headers:

I get this error:

From looking at the code, it doesn’t look like the headers have changed:


I get the same error when I try with the extra data object.

When I try the data object without the headers:

I get the same 200 code with the 0 response to show that the object failed again. I’ve also tried with an = after data:

and it gets the same result as when there is no = sign

Thanks for your help!

Hello @Luc_Zentar

I just tried to run the curl you provided and it doesn’t work for me

curl 'https://api-eu.mixpanel.com/track' \
  -H 'Accept: text/plain' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -data 'data={"event": "Signed up","properties": {"distinct_id": "00BA7F56-6834-4F83-9C00-F779161BCC75","token": "af06a617436f32bd0873f494d62b9b7c"}'

Could you please check if there are no mistakes?

Btw, when you use the application/x-www-form-urlencoded header, the data should be placed in the URL as query parameters.

Regards, Vlad

Try this logic:

@vladimir-upirov thank you. Backendless support is always top class, thank you for your help.

So I can learn for next time, why is the object sent as a query and not body, when it is a body request according to the API docs?

take a look at this topic 'x-www-form-urlencoded' or 'form-data' 😵 ? Explained in 2 mins. - DEV Community

Thank you