Media gallery images url instead of ID on WP API Response

This is the correct way to achieve it is this:

function show_main_image($object, $field_name, $request){
    $custom_fields = get_post_custom($object['id']);
    $main_image = $custom_fields['main_image'];
    $arregloimg = explode(',',$main_image[0]);

    $image_urls = array();
    foreach ( $arregloimg as $key => $value ) {
        $image_urls[] = wp_get_attachment_url($value,'thumbnail');
    };

    return $image_urls;
}