New mode to search with the search resource

21 December 2017

All searches about Items in the form of users/{Cust_id}/items/search, Questions and Answers in the form of /questions/search should be with access token; otherwise, they will fail.

New resources (Scan + Hash)

All the searches to the Items, Questions and Answers API in the form of users/{Cust_id}/items/search or /questions/search over 1,000 should have the new search_type=scan parameter without the offset parameter.
Note: if you want to query data below 1,000, you can continue doing it as today (with offset).

These are the steps to query more than 1,000 results:

  • Add search_type=scan to your query and remove the offset.
  • The result will be a scroll_id field.
  • Add to your scroll_id query the field obtained before.
  • You will get results starting from 1,000.
  • If you don’t use the limit parameter you will get a total of 50 items by default. You can add a maximum limit of 100.
  • To get the following result pages, you can do the same GET to the call until you reach the end of the list.

See below how to do it:
– Add search_type=scan to get the scroll_id:

Items

https://api.mercadolibre.com/users/{Cust_id}/items/search?search_type=scan&access_token=$ACCESS_TOKEN

Questions

https://api.mercadolibre.com/questions/search?search_type=scan&item={Item_id}&access_token=$ACCESS_TOKEN

Respuesta

"scroll_id": "YXBpY29yZS1pdGVtcw==:ZHMtYXBpY29yZS1pdGVtcy0wMQ==:DXF1ZXJ5QW5kRmV0Y2gBAAAAABIu7AgWMXl6anF3SU5SMVNaQXFxTkZubHBqQQ=="

– Add the scroll_id= obtained in the previous step:

https://api.mercadolibre.com/users/{Cust_id}/items/search?search_type=scan&access_token=$ACCESS_TOKEN&scroll_id=YXBpY29yZS1pdGVtcw==:ZHMtYXBpY29yZS1pdGVtcy0wMQ==:DXF1ZXJ5QW5kRmV0Y2gBAAAAABIu7AgWMXl6anF3SU5SMVNaQXFxTkZubHBqQQ==

To get the following result pages, you can do the same GET to the call until you reach the end of the list.

When the GET returns null you will be at the end.