phpapisdkinfusionsoft

Novak Infusionsoft SDK. How to retrieve all the information of all the Contacts at once?


I am using the novak infusionsoft SDK. Is there a way to retrieve all the information of all the users on my infusionsoft account all at once?

$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('Id' => 11));
print_r($contacts );

This only retrieves the Contact with the Id of 11. I would like to retrieve all of them all at once.

Please help


Solution

  • All at once no. Infusionsoft puts a limit to the number of contacts you can get out of it in once call. I believe the upper limit is 1000 at a time for one page. You can keep incrementing the page number until you receive a page less than 1000 (you know that would be the last page).

    It looks like the novak sdk supports this with the query function.

    public static function query($object, $queryData, $limit = 1000, $page = 0, $returnFields = false, Infusionsoft_App $app = null)
        {
            $app = parent::getObjectOrDefaultAppIfNull($app, $object);
            if(!$returnFields){
                $returnFields = $object->getFields();
            }
            $params = array(
                $object->getTable(),
                (int) $limit,
                (int) $page,
                $queryData,
                $returnFields
            );
            $records = $app->send('DataService.query', $params, true);
            return self::_returnResults(get_class($object), $app->getHostName(), $records, $returnFields);
        }
    

    Link to the DataService file: https://github.com/novaksolutions/infusionsoft-php-sdk/blob/master/Infusionsoft/DataService.php