Rest API, Fetch page with blocks that contain media uploads

default discord avatar
NuckFuggets
8 months ago
1

Hi I'm new to Payload and I've ran into a problem.



When I do a request from nextjs to payload the media field inside a block is always an ID but I want this to be a media object.



Payload setup:


Pages -> blocks -> a block that contains a media field



Nextjs request:


http://localhost:3001/api/pages?where%5Bslug%5D%5Bequals%5D=home&depth=2

I've tried settings the depth to a redicilous number e.g. 100 but that also returns a id.



Is this behaviour expected or am I doing something wrong?



I'm a idiot 😄, forgot to add the access permission on the media collection

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.