Title: posting through rest api
Last modified: April 4, 2019

---

# posting through rest api

 *  [ponzo](https://wordpress.org/support/users/ponzo/)
 * (@ponzo)
 * [7 years ago](https://wordpress.org/support/topic/posting-through-rest-api/)
 * Hello,
 * When I do a post request on postman, the contactform7 is working
 *     ```
       var data = new FormData();
       data.append("your-email", "wdwddwdw@dwwdwd.com");
       data.append("your-name", "fwwfwfwffw");
       var xhr = new XMLHttpRequest();
       xhr.withCredentials = true;
       xhr.addEventListener("readystatechange", function () {
         if (this.readyState === 4) {
           console.log(this.responseText);
         }
       });
       xhr.open("POST", "http://domain.local/wp-json/contact-form-7/v1/contact-forms/5/feedback");
       xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
       xhr.setRequestHeader("cache-control", "no-cache");
       xhr.setRequestHeader("Postman-Token", "43831d25-f107-4ab9-b5ad-2f9fecdbee78");
       xhr.send(data);
       ```
   
 * Gives me:
 *     ```
       {
           "into": "#",
           "status": "mail_sent",
           "message": "Thank you for your message. It has been sent."
       }
       ```
   
 * 5, in the url is the ID of my form.
    But when I use this within my development
   site I got
 *     ```
       {"into":"#","status":"validation_failed","message":"One or more fields have an error. Please check and try again.","invalidFields":[{"into":"span.wpcf7-form-control-wrap.your-name","message":"The field is required.","idref":null},{"into":"span.wpcf7-form-control-wrap.your-email","message":"The field is required.","idref":null}]}
       ```
   
 * Documentation on using contactform7 with the rest api, or plain javascript requests
   is very hard to find
 * Thanks

Viewing 1 replies (of 1 total)

 *  [wazexr](https://wordpress.org/support/users/wazexr/)
 * (@wazexr)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/posting-through-rest-api/#post-11666000)
 * How to using JSON format to post data?

Viewing 1 replies (of 1 total)

The topic ‘posting through rest api’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [rest](https://wordpress.org/support/topic-tag/rest/)

 * 1 reply
 * 2 participants
 * Last reply from: [wazexr](https://wordpress.org/support/users/wazexr/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/posting-through-rest-api/#post-11666000)
 * Status: not resolved