I've got a script which logs into Insightly CRM and extracts the contacts and pushes them into MySQL using a PHP script written in CodeIgniter.
Mostly it works well, until I hit this snag where one contact will have multiple roles and organisations that they can belong to. The code I'm using correctly pulls the first set of roles and organisations into MySQL, but I want to push any others into the same fields within MySQL, but perhaps split up by a comma. I'm using the following;
if(!empty($data->LINKS)) {
foreach($data->LINKS as $con_link) {
$arr_data = array(
'contact_role' => $con_link->ROLE,
'contact_organisation' => $con_link->ORGANISATION_ID
);
$this->insight->update_contact($contact_id,$arr_data);
}
}
The Insightly API information for contacts is here (look for the LINKS section); https://api.insight.ly/V2.1/Help/Api/PUT-Contacts
I've been going round in circles, and limited by my lack of knowledge, many thanks for any pointers.