• 0
Sign in to follow this  

how to retrieve more than 200 items per request


Hi I want to get all items in the books and magazines catagories from Argentina's site. I'm able to get a response but i only get (because of pagination) 200 items maximum.

Is it possible to get all the items?(in this case there are 4 millions items, i know it's a lot.)

Here´s my code:



require '../meliapp/Meli/meli.php';

$meli=new Meli(xxxxxxxxxx , xxxxxxxxxxxxxxxx);


if (isset($_GET['code']) ):

          $oAuth = $meli->authorize($_GET['code'], 'http://localhost/meliapp/index.php');
          if($oAuth['body']!==NULL || !empty($oAuth['body'])){
                $_SESSION['access_token'] = $oAuth['body']->access_token;
                $_SESSION['token_type'] = $oAuth['body']->token_type;
                $_SESSION['expires_in'] = $oAuth['body']->expires_in;
                $_SESSION['scope'] = $oAuth['body']->scope;
                $_SESSION['user_id'] = $oAuth['body']->user_id;
                $_SESSION['refresh_token'] = $oAuth['body']->refresh_token;

if(empty($_SESSION['access_token']) || !isset($_GET['code'])):

          echo "LOGIN NOW:<BR>";
          echo '<a href="' . $meli->getAuthUrl('http://localhost/hgin/meliapp/index.php', Meli::$AUTH_URL['MLA']) . '">Login using MercadoLibre oAuth 2.0</a>';


$params = array('category' => 'MLA3025', 'limit'=> '200'); 

$items = $meli->get('/sites/MLA/search', $params);


The variable $items only holds 200 items. But i know from inspecting $items['body']->paging->total that there are 4 million items.

Is there a way to get all 4 million items at once? or at least more than 200 items maximum per request.


Thanks in advance!!!







Edited by vittorio

Share this post

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

i already tried using offset, i have read the documentation. The question is weather its possible to retrieve more than 200 items per request. I guess that's the limit to not overwhlem the server or whatever. I benchmarked it and it takes around 3 seconds to retrieve 200 items, so it would require close to 17 hours to retrieve the 4 millons items  in the books and magazines category. My question was how do i do to request more items faster, but i'm thinkig there isn´t really a way since the amount of data is huge.

Share this post

Link to post
Share on other sites
  • 0

it's not possible, the limitation is 50 (some resources), and 200 for products ... the time spend is a questions about your server and codes, not the API

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this