Rest API submit form
-
Hello!
I am having trouble getting a form to submit using the wp rest API
Just wish to check if my setup and submission is good!
I think some fields might be wrong on but still wish to gain any help if anyone can do so.So its a VueJs SPA so the form is hooked up via a component I have built.
I have create the form in wordpress and used the ID, I send to the URL:
/wp-json/contact-form-7/v1/contact-forms/${formId}/feedbackSo the Data I sent is like so:
const data = new FormData();
data.append(‘_wpcf7’, this.$store.state.form_id);
data.append(‘_wpcf7_version’, ‘4.8’);
data.append(‘_wpcf7_locale’, ‘en_GB’);
data.append(‘_wpcf7_container_post’, 2);
data.append(‘_wpcf7_unit_tag’,’wpcf7-f422-p390-o1′);
data.append(‘_wpcf7_nonce’,this.nonce);
data.append(‘youremail’, this.email);
data.append(‘yourname’, this.name);then data gets passed as part of the ajax call (using axios).
Now I keep getting told the attempt is spam and rejected. I think it is the nonce, but pretty sure it is fine as if I deploy it normally it works.
Am I using all the fields above correctly?
Or Do I need to put the data together differently?
The topic ‘Rest API submit form’ is closed to new replies.