Documentación Mercado Libre
Descubre toda la información que debes conocer sobre las APIs de Mercado Libre.Documentación
Paging results
[...]
"paging": {
"total": 285,
"offset": 0,
"limit": 50,
}
[...]
Default values
Default values are offset=0 and limit=50.
curl -X GET https://api.mercadolibre.com/sites/MLM/search?q=ipod nano
In the paging section of the JSON response, you can see the total number of items that match the search and the offset value with the default limit applied.
[...]
"paging": {
"total": 285,
"offset": 0,
"limit": 50,
}
[...]
Limit
To reduce the page size you can change the limit parameter. For example, if you are interested in retrieving just the first 3 items:
curl -X GET https://api.mercadolibre.com/sites/MLM/search?q=ipod nano&limit=3
This action retrieves a JSON data with an array of 3 items as shown:
{
"site_id": "MLM",
"query": "ipod nano",
"paging": {
"total": 284,
"offset": 0,
"limit": 3,
},
"results": [
{...},
{...},
{...},
],
"sort": {...},
"available_sorts": [...],
"filters": [...],
"available_filters": [...],
}
Offset
By using the offset attribute, you can move the lower limit of the result block. For example, if you are interested in retrieving the 50 items that follow the default response:
curl https://api.mercadolibre.com/sites/MLM/search?q=ipod nano&offset=50
{
"site_id": "MLM",
"query": "ipod nano",
"paging": {
"total": 285,
"offset": 50,
"limit": 50,
},
"results": [...],
"sort": {...},
"available_sorts": [...],
"filters": [...],
"available_filters": [...],
}
This response retrieves 50 items starting from the first fifty items.
Define a range of results
It is possible to combine both parameters. You can retrieve items from the third to the sixth item in the original search result:
curl https://api.mercadolibre.com/sites/MLM/search?q=ipod nano&offset=3&limit=3
This action retrieves a JSON data with an array of 5 items as shown:
{
"site_id": "MLM",
"query": "ipod nano",
"paging": {
"total": 285,
"offset": 3,
"limit": 3,
},
"results": [
{...},
{...},
{...},
],
"sort": {...},
"available_sorts": [...],
"filters": [...],
"available_filters": [...],
}