How can I link contacts via the PHP ISDK?

I see that there’s a link to this fucntionality in the docs, but the documentation there itself is blank:
https://developer.infusionsoft.com/docs/xml-rpc/#contact-link-contacts

Any help would be appreciated.

interesting. no code for either php versions, just xml and python. Since it appears to be a part of the xml-rpc maybe you can get away with calling:

$this->methodCaller(“ContactService.linkContacts”, $carray); ?.. maybe?

Hi John,
Thanks, I’ll try that and let everyone know how that goes.

I actually wrote this into the isdk.php:

public function linkContacts($contactId1, $contactId2, $contactLinkTypeId){
    $carray = array(
         php_xmlrpc_encode((int) $contactId1),
         php_xmlrpc_encode((int) $contactId2),
         php_xmlrpc_encode((int) $contactLinkTypeId)
    );
    return $this->methodCaller("ContactService.linkContacts", $carray);
}

worked like a charm!

3 Likes

@Sehar_Sohail,

That is awesome! Thanks for sharing this so that others can benefit from the effort. Excellent!

1 Like

No problem!
Relatedly, I wrote this too – If you need to list all linked contacts for an account:

public function listLinkedContacts($contactId){
$carray = array(
php_xmlrpc_encode((int) $contactId)
);
return $this->methodCaller(“ContactService.listLinkedContacts”, $carray);
}

1 Like

Perfect! I was actually looking at this same thing the other day :wink:

Thanks again!