Search code examples
jsonwordpressapicontact-form-7

What Parameter Contact Form 7 using JSON to sent using API


I want create API for contact form 7.

How to send data from front-end to Contact Form 7 using WP rest api? I mean, what should the data structure be to send it via the POST method?

http://xx.xxx/wp-json/contact-form-7/v1/contact-forms/<id-form>/feedback

I trying different ways, but request always return response “validation_failed”, “One or more fields contain erroneous data. Please check them and try again.”

I did not find anything about this in the documentation.


Solution

  • add_filter( 'wpcf7_mail_components', 'show_cf7_request', 10, 3 );
    function show_cf7_request( $components, $wpcf7_get_current_contact_form, $instance ) { 
        print_r($_REQUEST);
        die();
        return $components; 
    }; 
    

    Don't try on LIVE ;)