teknikal
Member
I'm having issues running javascript code. works fine on my local machine, but getting the SyntaxError and I cant debug the issue as the error is too generic. can someone take a look?
Workflow Attached
Code is as follow (without APIKey)
Workflow Attached
Code is as follow (without APIKey)
Code:
const apiUrl = "https://api.cliniko.com/v1/appointments?q[]=starts_at:>=2023-08-24T00:00:00z&q[]=starts_at:<2023-08-25T00:00:00z";
const dateToRetrieve = '2023-08-24'; // Replace with the desired date
async function getAppointmentsForDate(date) {
try {
const response = await fetch(apiUrl, {
headers: {
authorization: 'Basic ',
'user-agent': 'Locally',
accept: 'application/json',
'content-type': 'application/json'
}
});
const filteredAppointments = response.json().then(result => result.appointments.filter(appointment => appointment.did_not_arrive));//;
return filteredAppointments;
} catch (error) {
throw new Error(error);
}
}
getAppointmentsForDate(dateToRetrieve)
.then(appointments => {
console.log('Appointments:', appointments);
})
.catch(error => {
console.error('Error:', error);
});