Mautic Community Forums

Form submition api

Your software
My Mautic version is: 2.16.2
My PHP version is: 7.2

Your problem
My problem is: I am trying to Post form data using api through postman, I am using basic auth.

POST https://<my_mautic>/api/form/submit?formId=2

Body
{
“email”: “naveen@gmail.com”,
“firstname”: “naveen”
}

(It may be noted that api to create contact https://<my_mautic>/api/contacts/new is working fine)

These errors are showing in the log:
{

"errors": [

    {

        "message": "Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator!",

        "code": 404,

        "type": null

    }

],

"error": {

    "message": "Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.)",

    "code": 404

}

}

Steps I have tried to fix the problem:

Just a quick comment: after allowing basic auth, you need to clear the cache.

@joeyk Thanks for the reply.

I tried after clearing cache, but same problem still.

I am also interested in submitting a form thru the api, but I could not found the documentation for this end point, someone can post a link for me?

I could send a post request to

/form/submit?formId=XX

but in that case I would have to send a application/x-www-form-urlencoded content instead of JSON and parse the html response, by submitting thru an API I want to send json content and receive the json response to handle the response my way.

is it possible? I could not find the documentation for the end point mention in this post:
/api/form/submit?formId=xxx