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