How to get more than 10 items from rest api

I’m trying to get more items from the execution below.

curl -X GET \
     -H "X-Algolia-API-Key: ${API_KEY}" \
     -H "X-Algolia-Application-Id: ${APPLICATION_ID}" \
    "https://analytics.algolia.com/2/searches?index=${index name}"

The doc below talks about ‘limit and offset’ but how to use them? I appended “&limit=100” but got only 10 items.

Hi @kenji ,

Thanks for contacting Algolia support and for your questions.

Your Question: The doc below talks about ‘limit and offset’ but how to use them?

  • Limit - As you already know, limit is the number of records returned.
  • Offset - Is the record to start at and we use a zero-based system. For example, to start at the first record, offset = 0, to start at the eleventh record, offset = 10.

To use these parameters in a request it would look like: limit=${your_limit}&offset=${your_offset}

Your Question: I appended “&limit=100” but got only 10 items.

The documentation is correct so could you please check that your request looks something like below, with your real information included:

curl -X GET \
 -H "X-Algolia-API-Key: ${your_admin_api_key}" \
 -H "X-Algolia-Application-Id: ${your_app_id}" \
"https://analytics.algolia.com/2/searches?index=${your_index_name}&limit=100"

I hope this helps. If you continue to run into issues, please let us know.

Happy Coding!

Thanks, Ajay.

It turned out that I didn’t double quote the last portion of the line. With them, I was able to get more than 10 items now.

By the way, do you know how soon this data (top searches) is available after the search has occurred?

Hi @kenji,

Great! Glad it worked.

The Analytics API updates fairly quickly, but not instantaneous. ~5 minutes should give you an updated API response!

Happy Coding!

UPDATE: Most reliable timeframe will be 15 minutes (see here)