I had to add this code from Stephen Mullen on StackOverflow to get it to work:
add_action( "rest_insert_user_question", function ( \WP_Post $post, $request, $creating )
{
$metas = $request->get_param( "meta" );
if( is_array( $metas ) ) {
foreach( $metas as $name => $value ) {
// update_post_meta( $post->ID, $name, $value );
update_field( $name, $value, $post->ID );
}
}
}, 10, 3 );
Then I could call the endpoint like this:
$data = [
'title' => 'Test post',
'status' => 'draft',
'content' => 'Some content',
'meta' => [
'my_custom_field' => 'Testing 1234',
]
];