fetch api only return ids of relationship field.

default discord avatar
itsjustchris
2 months ago
3

When GET request a collection endpoint (browser/postman) I get a full depth view of my relationship array, but when using the fetch api in my app I'm only receiving the IDs in the array. How can I get the full object instead of just the id?

  • default discord avatar
    Tinouti
    2 months ago
    depth

    might be what you're looking for:

    https://payloadcms.com/docs/getting-started/concepts#depth
  • default discord avatar
    SKRY
    2 months ago

    I had the same problem and I fixed it by adding a depth parameter in the url that I'm fetching (100 is probably to much)

    image.png
  • default discord avatar
    itsjustchris
    2 months ago

    I actually goofed up, I was working on the collection in dev, and my app was fetching from production. Thanks any way.

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.