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

Publié sur un an il y a par  Julien Pauthier

Publier un sujet
Julien Pauthier
Julien Pauthier Administrateur

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 Commentaires

Connexion ou S'inscrire pour poster un commentaire