PHP | How to get a list of all appointments for the rest of the year

Posted over 1 year ago by Julien Pauthier

Post a topic
Julien Pauthier
Julien Pauthier Admin

You can extract all upcoming appointments of the year, along with a link to the appointment pages in the backoffice (useful if you need to update or reassign a list of appointments to a specific staff):


<?php
$apiKey = "";
$ssoToken = "";
$company = "";

$startDate = date("Y-m-d\T00:00:00P", strtotime('now'));
$endDate = date("Y-m-d\T23:59:59P", strtotime('31 December 2020'));

$data = file_get_contents("https://api.agendize.com/api/2.1/scheduling/companies/$company/appointments?startDate=$startDate&endDate=$endDate&apiKey=$apiKey&token=$ssoToken");
$clients = json_decode($data);

echo "Client\tDate\tLink in Agendize backoffice\n";
foreach ($clients->items as $rdv) {
echo substr($rdv->client->firstName, 0, 1) . ". " . substr($rdv->client->lastName, 0, 1) . ".\t";
echo $rdv->start->dateTime . "\t";
echo "https://app.agendize.com/console/scheduling/view-event.jsp?id=" . $rdv->id . "\n";
}
?>


0 Votes


0 Comments

Login or Sign up to post a comment