Show Available Slots
This endpoint retrieves available time slots for specified resources or schedulers within a given date range. It dynamically calculates availability based on current bookings, predefined rules, and resource constraints, providing a real-time view of open slots.
Authentication
This endpoint needs app token for authentication.
Method | POST |
---|---|
Endpoint | v1/slots/available |
Headers | Accept: application/json |
Authorization: Bearer <base64_encoded_token> | |
Token type | App |
Request Body:
This endpoint requires following parameters to be sent via post body:
Param Name | Required | Description |
---|---|---|
output_timezone_ | false | output results in timezone |
duration | false | duration in minutes or hours i.e. 30 minutes or 1 hours. If not provided uses scheduler settings. |
start | false | start date to search slots. If not provided uses scheduler settings. |
end | false | end date to search slots. If not provided uses scheduler settings. |
buffer_time | false | buffer in minutes or hours i.e. 30 minutes or 1 hours. If not provided uses scheduler buffer_time settings |
round_to_mins | false | round start time in increment of 15, 30, 45 or 60 minutes |
booking_window | false | slots look up period in days, weeks or months i,e. 4 weeks. If not provided uses scheduler booking_window settings |
resources | false | list of resources that falls under given scheduler |
scheduler_id | true | scheduler uuid |
Example Request:
Following code shows how to send request to create a resource in Slotify api.
- PHP
- BASH
- JSON
$apiEndpoint = 'https://api.slotify.ca/v1/slots/count';
$apiToken = base64_encode("app-token");
$data = array(
"scheduler_id" => "28f0b45d-d14f-438f-b59a-833a57a31147",
"output_timezone" => "America/Toronto",
"start" => "2024-09-05T09:00:00-04:00",
"end" => "2024-09-05T10:00:00-04:00"
);
$ch = curl_init($apiEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $apiToken,
'Content-Type: application/json'
));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if(curl_errno($ch)){
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
echo $response;
curl -X POST \
-H "Authorization: Bearer <APP_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"scheduler_id": "28f0b45d-d14f-438f-b59a-833a57a31147",
"output_timezone": "America/Toronto",
"start": "2024-09-05T09:00:00-04:00",
"end": "2024-09-05T10:00:00-04:00"
}' \
https://api.slotify.ca/v1/slots/count
{
"scheduler_id": "28f0b45d-d14f-438f-b59a-833a57a31147",
"output_timezone": "America/Toronto",
"start": "2024-09-05T09:00:00-04:00",
"end": "2024-09-05T10:00:00-04:00"
}
Example Response:
Following response will be provided by Slotify server when this endpoint is called:
- 200 OK
- 400 Bad Request
{
"success": true,
"data": [
{
"start": "2024-09-05T09:00:00-04:00",
"end": "2024-09-05T10:00:00-04:00",
"resources": [
{
"uuid": "1d9ca4d0-af0e-41a5-8188-c1bba0183505",
"name": "Candice Ortiz",
"timezone": "America/Toronto"
}
]
}
]
}
{
"success": false,
"errors": {
"scheduler_id": "Entity not found"
}
}