Problem with REST API get_entry_list

Hi all,
I am doing a script to update a huge amount of documents with the REST api of sugarcrm.
I already performed a masse upload of new documents and all went well.
But this time i want to update documents, so i was trying to get the list of all the entries with get_entry_list.

The problem I have is it ALWAYS return only 20 raw per request, even when i try to add the max_results settings. and it is ALWAYS the 20 first one, even whne i try to change the offset. I copy paste here what i tryed and maybe someone can tell me where my mistake is ^^

First is the last try i did, then it just is the change i tryed before :

for ($i=0; $i < 250; $i++) {
  // get all the docs in database
  $parameters = array(
    'session' => $sessionId,
    'module_name' => 'Documents',
    'offset' => (20 * $i),
  );
  $json = json_encode($parameters);
  $postArgs = array(
    'method' => 'get_entry_list',
    'input_type' => 'JSON',
    'response_type' => 'JSON',
    'rest_data' => $json
  );
  curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);

  // Make the REST call, returning the result
  $response = curl_exec($curl);
  if (!$response) {
      return 1;
  }
  // Convert the result from JSON format to a PHP array
  $result = json_decode($response);
  if ( !is_object($result) ) {
      return 1;
  }
  $documents_entry_array[] = $result->entry_list;
}

$parameters = array(
    'session' => $sessionId,
    'module_name' => 'Documents',
    // 'max_results' = 5000,
  );
  $json = json_encode($parameters);
  $postArgs = array(
    'method' => 'get_entry_list',
    'input_type' => 'JSON',
    'response_type' => 'JSON',
    'offset' => (20 * $i),
    'rest_data' => $json
  );

Thank you for helping me :slight_smile:

I don’t have experience with the REST API, but I wonder why you’re not using the beans? Are you running this from the same computer where SuiteCRM is?

Also, you might want to do it directly on the database and the file system.

But the beans would be the recommended way to go, I believe…

Do you have any idea where i can find the documentation for the beans ? I used it a bit when i did some hook_process, but i just copy paste what i saw and it worked for me, so i don’t know where is the documentation.

Thanks for the quick reply

By far your best solution is to buy the eBook “SuiteCRM for Developers” by Jim Mackin.

If you don’t want to spend that money, you can look for documentation for SugarCRM version 6.5, it’s very similar:

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/

Watch out for documentation for SugarCRM 7.0, Google keeps showing you that when you search, but that is NOT what you want.