'404 Error Contact Form 7 ajax form submitting

The contact form does not work, and affects loading after one try. The chrome console shows the error message:

POST http://example.com/wp-json/contact-form-7/v1/contact-forms/50/feedback 404 (Not Found)
send @ jquery.js?ver=1.12.4:4
ajax @ jquery.js?ver=1.12.4:4
wpcf7.submit @ scripts.js?ver=5.0.3:346
(anonymous) @ scripts.js?ver=5.0.3:53
dispatch @ jquery.js?ver=1.12.4:3
r.handle @ jquery.js?ver=1.12.4:3

How to solve this issue? thanks in advance



Solution 1:[1]

I had the same issue after migrating the site, re-save the Settings -> Permalinks in wordpress fixed it.

Solution 2:[2]

FINALLY FIXED!!

Since I'm using nginx all the solutions doesn't worked for me.

I finally fixed that error adding the following lines to the nginx.conf (or file wich contains your server config)

location ~ ^/wp-json/ { rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last; }

I hope it helps to someone

Solution 3:[3]

You Error message clearly shows that particular endpoint doesn't exists.

http://example.com/wp-json/contact-form-7/v1/contact-forms/50/feedback

What i remember, the Wordpress json API mappings has base address of

http://example.com/wp-json/wp/v2/

So, try once if your url is working with this base address or not. Change url to

http://example.com/wp-json/wp/v2/contact-form-7/v1/contact-forms/50/feedback

Or just check proper mappings from http://example.com/wp-json.

This is not a Wordpress pre-defined endpoint and is enabled by Third party plugin mainly contact-form-7. Make sure you have installed this plugin to your wordpress.

PS : Make sure you are using valid authentication method as certain end-points won't work without that.

Solution 4:[4]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BlueP
Solution 2 J. Rubinart
Solution 3
Solution 4 adi