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.

API Request

default discord avatar
steproblast year
1

I have my collection province.ts, what should I configure so that when I make the request the API returns me all the provinces related to a department, the ID of the department will be sent from the Frontend.

  • default discord avatar
    paulpopuslast year

    Depending on if you're using gql/rest or the local API, you basically want to add a

    where

    to filter by department in your query for provinces



    https://payloadcms.com/docs/queries/overview#rest-queries

    This page has information for all sorts of querying, filtering and sorting for all 3 APIs



    In the example there, using the REST api

    https://localhost:3000/api/posts?where[color][equals]=mint

    filters by a color field

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.