How to fetch more than 100 items limit with Apollo graphql and strapi?

Hello and thank to take the time to answer my question.

Strapi fixed a limit of 100 fetch items. My question is how to fetch more than the 100 limit items. I made my request with Apollo graphql.

I started to use parameters in my graphql request. But it allow to limit the number only on the limit of the api. So, I can fetch only 20 items for exemple, but not 110 items for exemple:

export const GET_ALL_DROPS = gql`
  {
    drops(limit: 20) {
      id
      brand_name
      model_name
      ...
    }
  }
`;

I imagine it’s possible to pass parameter in the api call, but I don’t know how to.

I stock my api url here:

export const API_URL = “https://my-api”;
export const API_URL_GRAPHQL = ${API_URL}/graphql;

Here I use Apollo to dispatch my api:

const client = new ApolloClient({
uri: API_URL_GRAPHQL,
cache: new InMemoryCache(),
});

Here I use my request, but there is max 100 items:
const { data, loading, error } = useQuery(GET_ALL_DROPS);

I would like to avoid changing the limit directly in the back Strapi.

Thank you in advance !

I’m not sure I entirely understand your question. There are parameters to increase the limit (as you’ve shown in your example) and we generally recommend combining the start and limit parameters to page through your data instead of trying to fetch it all at once.

We also have a configuration option for a maximum limit that you can adjust, but again we recommend you don’t increase this too much as there is a massive performance issue.

You can find the configuration options here: https://strapi.io/documentation/v3.x/plugins/graphql.html#configurations

The limit configuration is called amountLimit with a default of 100

1 Like

Thanks for your answer !
I will look in this direction thank you.

1 Like