Rest Api not working with Iframe in form data

I have created one api with post request.

register_rest_route('myapi/v1', '/post_flyer', array(
        'methods' = 'POST',
        'callback' = 'api_post_flyer',
    ));

I have to submit form data with iframe/iframe or script/script tag in post content.

When i am try to check this api using postman, every time its display the error like "No route found",

"code": "rest_no_route",
"message": "No route was found matching the URL and request method",
"data": {
    "status": 404
}

While whole functionality is there, So i want to know that how to enable api to accept iframe and html tags for post content?

Topic posts custom-post-types Wordpress

Category Web


Please remove "/" from route and try using add action like

add_action( 'rest_api_init', function () {    
register_rest_route('myapi/v1', 'post_flyer', array(
            'methods' => 'POST',
            'callback' => 'api_post_flyer',
        ));
});

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.