PHP | How to get a list of all contacts from your CRM

Posted over 1 year ago by Julien Pauthier

Post a topic
Julien Pauthier
Julien Pauthier Admin

You can extract a list of clients, separated as tabs (TSV) or coma (CSV):


<?php 
$apiKey = "";
$ssoToken = "";
$data = file_get_contents("https://api.agendize.com/api/2.0/clients?apiKey=$apiKey&token=$ssoToken");
$clients = json_decode($data);

echo "Firstname\tLastname\tEmail\tPhone\tAddress\tTags\n";
foreach ($clients->items as $client) {
    echo $client->firstName . "\t" . $client->lastName . "\t" . $client->emailAddresses[0]->email . "\t" . $client->phoneNumbers[0]->number . "\t" . $client->address->street . " " . $client->address->zipCode . " " . $client->address->city . " " . $client->address->country . "\t";
    if (is_array($client->tags))
    foreach ($client->tags as $key => $tagItem) {
        echo $tagItem->tag . "\n";
    }
    echo "\n";
}
?>



0 Votes


0 Comments

Login or Sign up to post a comment