How to Get Featured Image from REST API?

I am trying to get the featured image of a post using the WordPress REST API. I am adding the extention of ?embed to the end if the REST API url and I am seeing the featured image data under ['wp:featuredmedia'], but I can't seem to display that data.

I am using Vue to display data from the REST API and so what I am doing currently to try and get the featured image source is: post._embedded['wp:featuredmedia'][0].source_url

But by doing that it can't find the source url of the featured image and I am not sure what is wrong with my path for it to not find the source url data?

Topic rest-api json Wordpress

Category Web


I used Better REST API Featured Image plugin. that adds the featured image URL to the original API response.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.