Get multiple contacts with Rest API call

I am looking to retrieve a list of contacts filtered by contact Ids. I couldn’t figure out if there was an API to do this. I can also use the PHP-SDK. Any help or suggestion towards this is highly appreciated.

Hi @Salman_Javeed,

The PHP SDK Route is not the option here unfortunately.

In the REST API v1, which the SDK uses, it does not have any capability to query multiple Contact IDs.
https://developer.keap.com/docs/rest/#tag/Contact/operation/listContactsUsingGET

But in the REST API v2, you can set the “filter” property with an Set String of Contact IDs.
https://developer.keap.com/docs/restv2/#tag/Contact/operation/listContactsUsingGET_1

Or, you can use the XML-RPC and do a Query on the Contact record instead with an array of the Contact IDs.
https://developer.keap.com/docs/xml-rpc/#data-query-a-data-table

You will have to decide what to do here.

Hi @Pav Thank you so much for taking time to reply to my question. I resolved it using PHP-SDK in Laravel. I passed the Id values as an array which perfectly returned all the related contact info.

For someone seeking this in future:

$infusionsoft = new Infusionsoft(['apikey' => $keap_api_key,]);;
        $data = $infusionsoft->data()->query("Contact", 1000, 0, ['Id' => [123, 124]], ['Id', 'FirstName', 'LastName', 'Email'], 'Id', false);
1 Like