<?php require "../vendor/autoload.php"; /* These are keys from my Trial Account... you won't find much here */ $key = "53c23842e4b0dd8125a7eab9"; $secret = "0UlIeso9k33jAVRvTssDixX8A3i"; $riq = new \nathanabrewer\RelateIQ\RelateIQ($key, $secret); $csv = array_map('str_getcsv', file('surnamereps.csv')); foreach ($csv as $rep) { $name = $rep[1] . " " . $rep[0]; $name = $rep[1] . " " . $rep[0]; $email = null; $phone = null; $address = null; $contact = $riq->newContact($name, $email, $phone, $address); $contact = $contact->save(); echo "Saved {$name} as {$contact->id}\n"; }
<?php require "../vendor/autoload.php"; /* These are keys from my Trial Account... you won't find much here */ $key = "53c23842e4b0dd8125a7eab9"; $secret = "0UlIeso9k33jAVRvTssDixX8A3i"; $riq = new \nathanabrewer\RelateIQ\RelateIQ($key, $secret); $contact = $riq->getContact('53c238d7e4b0d0612a7b84bd'); $contact->properties->remove('email', '*****@*****.**'); $contact->properties->add('email', '*****@*****.**'); $contact->save(); $myApplicationList = $riq->getList('53b1bf43e4b0f0eb6bc6ce74'); //foreach($myApplicationList->getListItems() as $listItem){ // echo $listItem->id."\n"; //} /* we can getContact, or we can getContact without an API call... i.e. just a container for simple updates.. saves an API call */ $listItem = $myApplicationList->getListItem('53c23b82e4b0d0612a7b85c5'); $listItem->setField('Status', 'Active'); $listItem->setField('Drinks', array('Tea', 'Coffee', 'Water')); $listItem->save(); //If I want to avoid an API call, because I already have a contact.... $listItem = $myApplicationList->listItemContainer(); $listItem->setContact($contact); $listItem->setField('Status', 'Active'); $listItem->save();
<?php require "../vendor/autoload.php"; /* These are keys from my Trial Account... you won't find much here */ $key = "53c23842e4b0dd8125a7eab9"; $secret = "0UlIeso9k33jAVRvTssDixX8A3i"; $riq = new \nathanabrewer\RelateIQ\RelateIQ($key, $secret); $lists = $riq->getLists(); echo "loop through lists...\n"; foreach ($lists as $list) { echo "{$list->id} -- {$list->title}\n"; //lets pick one out that we know.... if ($list->id == "53b1bf43e4b0f0eb6bc6ce74") { //iterate through the listItems... foreach ($list->getListItems() as $listItem) { echo "Lets make changes to list item {$listItem->id} ...\n"; $listItem->setField('Distro', 'Good Test'); $result = $listItem->save(); } } } die; $contacts = $riq->getContacts(); $someRandomEmail = "*****@*****.**"; foreach ($contacts as $contact) { echo "\n\nContactId: {$contact->id}\n"; foreach ($contact->properties->get('name') as $name) { echo "Name: {$name}\n"; } echo "Modified: {$contact->modifiedDate}\n"; echo "Email Addresses: ";
<?php require "../vendor/autoload.php"; /* These are keys from my Trial Account... you won't find much here */ $key = "53c23842e4b0dd8125a7eab9"; $secret = "0UlIeso9k33jAVRvTssDixX8A3i"; $riq = new \nathanabrewer\RelateIQ\RelateIQ($key, $secret); $contact = $riq->getContact('53c238d7e4b0d0612a7b84bd'); $listItems = $riq->getAllListItemsForContact($contact); foreach ($listItems as $listItem) { echo "Contact {$contact->getName()} (cid {$contact->id} has a ListItem {$listItem->id} on List {$listItem->listId} {$listItem->getList()->title}\n"; }