Hi all
I have a block that returns some items and one of which is an image.
I can't however get the actual image to return, it just returns me the image id. Is there any way to get the actual image to be returned with all the data?
I can see the image data in the API URL so I believe it is probably related to the image being of type
string | Media
?
Do I need to query the images separately?
I'm also using the REST API by the way.
Ahh figured out the issue, I didn't have the right access set on the Media collection!
access: {
read: () => true
}
You need to set/increase the
depth
parameter in your request. Payload doesn't populate nested document by default and only gives you the
id
of it.
Well you were too fast 😀
Ah haha sorry mate, we were right on the same submit time. Thanks for your reply though. I was checking the depth but could see I was getting the data back in the API. I just couldn’t access it. Then when querying the media by itself, I realised that it wasn’t working which is when I tested the access.