Rest Api not working with Iframe in form data

Please remove “https://wordpress.stackexchange.com/” 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',
        ));
});