Display Post Featured Image along with Categories via WP Rest API

I have found the solution with the help of a great friend. I will post it here if anyone else needs to utilize the fucntion. Again in summary, this function will display posts from another blog and you can enter specific category ID’s from the other blog and also control how many posts are displayed.

function feedpuller_func($atts)
{
    $url = $atts['url'];

    $count = ($atts['count'])?$atts['count']:'3';
    $imgsize = (in_array($atts['img'], array('thumbnail','medium','large','full')))?$atts['img']:'thumbnail';

    if($atts['catid'])
    {
        $cat="?_embed&categories=".$atts['catid'].'&per_page=".$count;
        $response = wp_remote_get( $url."/wp-json/wp/v2/posts/'.$cat );
    }
    else if ($atts['slug']) 
    {
        $slug = $atts['slug'];
        echo $url . '/wp-json/wp/v2/categories?slug=' . $slug;
        $responseslug = wp_remote_get($url . '/wp-json/wp/v2/categories?slug=' . $slug);
        $postdata = json_decode( wp_remote_retrieve_body( $responseslug ) );
        if($postdata)
            $catid = $postdata[0]->id;
        else
            echo 'no record against this slug';
        if($catid)
        {
            $cat="?categories=".$catid.'&per_page=".$count;
            $response = wp_remote_get( $url."/wp-json/wp/v2/posts/'.$cat );
        }

    }
    else 
        $cat="";

    if( is_wp_error( $response ) ) {
        return;
    }

    $posts = json_decode( wp_remote_retrieve_body( $response ) );

    if( empty( $posts ) ) {
        return;
    }

    if( !empty( $instance['title'] ) ) {
        echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $args['after_title'];
    }

    if( !empty( $posts ) ) {

        echo '<ul class="feedothersite">';
        foreach( $posts as $post ) { //echo '<pre>'; print_r(); exit;
            $imgurl = $post->_embedded->{'wp:featuredmedia'}[0]->media_details->sizes->$imgsize->source_url;
            if($imgurl)
                $img = '<img src="'.$imgurl.'">';
            else
                $img = '';

            echo '<div class="feedcontent"><a href="' . $post->link. '"><li><div class="feedimg">'.$img.'<div><h2>' . $post->title->rendered . '</h2></a></div></li>';
        }
        echo '</ul>';
    }
}

add_shortcode("feedpuller","feedpuller_func");

Shortcode value should follow [feedpuller url=”http://othersite.com/” catid=”22″ count=”4″] To display featured image, use: img=”full” img=”medium” or img=”thumbnail”