简体   繁体   中英

infusionsoft api - how to get contact details by using contact id as filter

I'm using the resthook feature of infusionsoft. The endpoint will return the contact id now I want to get full contact details using the id.

$contacts       = $infusionsoft->contacts()->load($contactid,$fields);

I'm using this as of the moment but it's not working. I tried this:

$contact = $infusionsoft->contacts()->where(['Id' => $contactid])->get();

but it is ignoring the where statement.

I spent hours just to figure this out.

If you're just trying to pull up a single contact, you can use the load method instead:

$contact = $infusionsoft->contacts()->load($contactid, $fields);

Note that the contacts() method accepts a parameter that defaults to 'rest' but can also be set to 'xml' for the XMLRPC.

If for some reason you want to do it through the XMLRPC, don't get too attached, it was recently marked deprecated:
https://developer.infusionsoft.com/developer-guide/
It won't be disappearing any time soon, but it's a good idea to start trying to use the REST api as much as possible.

But if you need to pull up multiple contacts, I'm not familiar with a way to do it with the REST api, but you can do it through the XMLRPC using the Table Schema like so:

$contacts = $infusionsoft->data()->query('Contact',1000,0,['Id'=>$contactIds],$fields,'Id',true);

The Table Schema is much more powerful than the REST api in my experience.

Unfortunately, the Table Schema is only available through the XMLRPC and thus deprecated with it. We'll probably see a lot of the XMLRPC's features enter into the REST api before the XMLRPC ever disappears. However a lot of the REST api is behind in documentation. If you discover something, create an issue over here so it can be added to the library:

https://github.com/infusionsoft/infusionsoft-php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM