wordpress api get post meta code example
Example: wordpress get posts with meta data rest api
register_rest_field( 'post', 'metadata', array(
'get_callback' => function ( $data ) {
return get_post_meta( $data['id'], '', '' );
}, ));