Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Rest API, Fetch page with blocks that contain media uploads

default discord avatar
NuckFuggets2 years 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

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.