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.

Fetching all documents through RestAPI

default discord avatar
samy7288last year
7

It might be a stupid question but I couldn't find the information in the Payload documentation. I'm trying to fetch my data without any pagination. Is there a cleaner way to do it without doing :


axios.get("/my-query?limit=10000")?
  • default discord avatar
    notchrlast year

    Good catch, the documenation could probably put in a note about not paginating, though, it's likely less common behavior.



    https://payloadcms.com/docs/queries/pagination#pagination
  • default discord avatar
    filippomasoni12 months ago

    I was using limit=0 for some REST request but after updating to payload 2.0 it stopped working, but I can't find that documented anywhere. Is this a bug or did something change?

  • default discord avatar
    samy728812 months ago

    Apparently they changed some stuff and I’m also facing the same issue now

  • default discord avatar
    filippomasoni12 months ago

    I'm now using limit=1000 which is not ideal, but I can't find a workaround. In the documentation limit=0 is not documented but it says pagination can be disabled only for the Local API. I guess that's changed without documenting it.

  • default discord avatar
    samy728812 months ago

    There's an open issue on the matter :

    https://github.com/payloadcms/payload/issues/4143
  • default discord avatar
    arne02394 months ago

    I had an issue with only adding

    ?limit=0

    . The query failed because the defaul locale was appended to the query. Therefore I had to set it to

    usePayloadAPI( 'http://localhost:4000/api/surveyQuestions?limit=0&locale=no', )
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

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