This should be an easy one. How do I get strapi query to return all entries in version v4

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

First, _limit=-1 does not work in v4 everyone keeps telling me it does, but it does not.

I have googled, read the docs, and read through the git hub.
I am still struggling to get the most basic response, all items in a table.
PLEASE HELP lol

here is my current query:

const res = await fetch(`${API_URL}/api/events?sort=date&pagination[pageSize]=200&populate=*`);

despite specifying 200 this only returns 100 results. I would like to return all results. Not 100, not 200, all of the results.

I still don’t understand why returning all responses isn’t the default behaivore.

The ./config/api.js lets you configure the limits.

Its default configuration is:

module.exports = {
  rest: {
    defaultLimit: 25,
    maxLimit: 100,
    withCount: true,
  },
};

I think because of maxLimit: 100 you get at most 100 items, despite providing -1 or 200 with your REST request.

2 Likes