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
    filippomasoni11 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
    samy728811 months ago

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

  • default discord avatar
    filippomasoni10 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
    samy728810 months ago

    There's an open issue on the matter :

    https://github.com/payloadcms/payload/issues/4143
  • default discord avatar
    arne02393 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.