In old versions of Strapi, we could use ?limit=-1
to get all entries of a table. However, this apparently does not work anymore, although I’ve not really tried it yet.
Right now, to get all data, I just have the following in my config/api.js
module.exports = {
rest: {
defaultLimit: 10000000,
maxLimit: 10000000,
withCount: true
}
};
Now, in my case, I don’t have more than 2k entries in any of the tables and I don’t expect to get to 1 million any time soon, but still would like to be able to get all entries, even if I have more entries than the defaultLimit
or maxLimit
.
Here REST API | Strapi Documentation I couldn’t find a solution. After having read this Parameters | Strapi Documentation, it seems that I may be able to use the pagination
parameter to get all data, but I am not sure if this pagination parameter can really be used for that or is used only to break the maximum number of entries we may get (as specified in config/api.js
) into pages.
What’s the correct way of getting all entries from a table in Stapi 4.16.2 (preferably, with one request, but it’s ok if I also need to make more)?
Could this maybe be done with a custom route, which, on the backend side, takes care of getting all data? I suppose so. If anyone has a concrete code example, it would be great.
Note I can’t update the Strapi version because newer versions removed a feature that I need (i.e. there’s yet another bug in Strapi).
Yes, I’ve already gone through Get all records from collection. I’d like to do this without the help of third-party tools or plugins