4

Can anyone explain why limit here has no effect? Still get 25 results every time. Also tried 'api.Contact.get' => array(array('limit' => 1000))

Using offset to recurse through the set works but is a nuisance.

 require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/civicrm/civicrm.settings.php';
 require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/civicrm/civicrm/CRM/Core/Config.php';
 $config = CRM_Core_Config::singleton( );
 require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/civicrm/civicrm/api/api.php';
 $result = civicrm_api3('Membership', 'get', array(
    'membership_type_id' => "$level",
    'limit' => 1000,
    'api.Contact.get' => array(),
 ));
6

You need to use options.limit to make this work.

options.limit : The maximum number of records to return. You can make this unlimited by setting the value to 0.

Usage

$result = civicrm_api3('Membership', 'get', array(
  'membership_type_id' => "$level",
  'options' => array('limit' => 1000),
));

Get more details on the different parameters you can use under options.

Also check : How do I get more than 25 records from the API?

  • Thank you. For some dim reason I thought what I was passing was the options array... Much obliged. – jerrygarciuh Dec 14 '15 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.