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

Posted almost 2 years ago by Angélique Bernardo

Post a topic
A
Angélique Bernardo 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