Hi guys, do you know if there is a "pick" options ...

default discord avatar
last month
Original message from @<Clement/> - Moved from https://discord.com/channels/967097582721572934/967097582721572937/1136640823660904530 (in #general)

Hi guys, do you know if there is a "pick" options when I query with REST API + qs. For example I need to list the all pages of the site, but I only need the title and slug.

  • discord user avatar
    Payload Team
    last month

    Hey @<Clement/>, there is no Pick option via the REST API. You could either open a custom endpoint and then use underlying model to query the DB, or use GraphQL

    Custom endpoint would be pretty easy to throw together honestly.


    Then you can access payload off the req and do payload['collection-slug'].Model and perform your specific find operation using the Model

  • default discord avatar
    last month

    Ok cool, thx for your quick answer ! 🙏

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


Connect with the Payload Community on Discord



Can't find what you're looking for?

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