I recently added Contact-Form-7 to my WordPress admin panel, which generated an API Endpoint for me at
http://localhost/wordpress/wp-json/contact-form-7/v1/contact-forms
Attempting to send a POST request to this endpoint using the following code:
data() {
return {
form: {
fullname: '',
email: '',
subject: '',
message: ''
}
}
},
methods: {
sendForm() {
postRequest('/wp-json/contact-form-7/v1/contact-forms', this.form)
.then(response => {
console.log('Success --> ' + response.data)
})
.catch(error => {
console.log('Error --> ' + error)
})
}
}
The result of this attempt was:
POST http://localhost:8080/wordpress/wp-json/contact-form-7/v1/contact-forms 403 (Forbidden)
Error: Request failed with status code 403