How to use the Contact Form 7 REST API?
-
I have a contact form 7 loaded asynchronously into a page using wpapi. It does not work, probably because when loading the contact form, the required JS code is not loaded.
There is no error initially, but, when trying to submit the form, a new tab opens in Firefox with the URL:
http://localhost/wp-json/wp/v2/pages?slug=contact#wpcf7-f51-o1
And the body:
{"code":"rest_cannot_create","message":"Regret, nu ai voie s\u0103 creezi articole \u00een numele acestui utilizator.","data":{"status":401}}
The message, translated, would be: “I am sorry, but you cannot create articles in the name of this user.”.
I am also not sure if the CSS is loaded for the form, if the plugin has special CSS applied to pages with contact forms.
What would be the solution? I thought about using the REST API endpoint suggested [here](https://wordpress.org/support/topic/contact-form-7-rest-api-for-native-mobile-app/#post-12130487) but, also because there it is an older version, I am not sure of the way I should use it.
What would be a sample request? Is there somewhere in the Internet documentation for this? Should I look into the code of the Contact Form 7?
I use the latest version of WP (5.4) and Contact Form 7 (5.1.7).
Thank you.
- The topic ‘How to use the Contact Form 7 REST API?’ is closed to new replies.