Mautic Community Forums

Error 400 on API call

I want to learn a couple of things about the API so I did a VERY primitive test. I created a couple of plain HTML forms through which I manually catch the Access Token. Which I then manually put in other forms. This works perfectly OK for READ calls, I can list all leads, search for a lead, list users, etc. This all works (i.e I am catching the Access Token OK, the API is enabled etc etc)



But when trying any WRITE action, it returns a blank JSON with an error 400 code and nothing gets written.



This is the form I am trying (again, I change the Access Token so that is not the problem)

Code:

Is this approach theoretically possible?

Any ideas what is wrong with this POST?

Many, many thanks!

I want to learn a couple of things about the API so I did a VERY primitive test. I created a couple of plain HTML forms through which I manually catch the Access Token. Which I then manually put in other forms. This works perfectly OK for READ calls, I can list all leads, search for a lead, list users, etc. This all works (i.e I am catching the Access Token OK, the API is enabled etc etc)

But when trying any WRITE action, it returns a blank JSON with an error 400 code and nothing gets written.

This is the form I am trying (again, I change the Access Token so that is not the problem)

[code]




[/code]

Is this approach theoretically possible?

Any ideas what is wrong with this POST?

Many, many thanks!

I had a similar issue, but using the api library. I don’t know if you resolved your issue, but I think the problem come from the input submit.
When mautic receive a field it doesn’t know, you get the error 400 Bad request.

See my reply in this thread https://www.mautic.org/community/index.php/conversation/post/12215

Hope it helps.