PHP | Reseller API: how to get a list of all call-tracking phone numbers from your customers

Posted over 1 year ago by Julien Pauthier

Post a topic
Julien Pauthier
Julien Pauthier Admin

Here is a short PHP script to query the reseller API, read the JSON structure and connect to each customer account to retrieve the list of associated call-tracking phone numbers. The output is using tabs in a CSV file format, so that you can open it in a spreadsheet editor, such as Excel .


<?php 
$data = file_get_contents('https://api.agendize.com/api/2.0/resellers/accounts?apiKey=$APIKEYRESELLER&token=$SSOTOKENRESELLER');
$clients = json_decode($data);
foreach ($clients->items as $client) {
    $data2 = file_get_contents("https://api.agendize.com/api/2.0/calls/calltrackings?apiKey=$APIKEYRESELLER&token=" . $client->ssoToken);
    $ct = json_decode($data2);
    echo $client->email . "\t" . $ct->items[0]->trackingPhoneNumber . "\t" . $ct->items[0]->phoneNumber . "\t" . $ct->items[0]->name . "\n";
}
?>


0 Votes


0 Comments

Login or Sign up to post a comment