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.

MethodPOST
Endpointv1/slots/available
HeadersAccept: application/json 
Authorization: Bearer <base64_encoded_token> 
Token typeApp

Request Body:

This endpoint requires following parameters to be sent via post body:

Param NameRequiredDescription
output_timezone_falseoutput results in timezone
durationfalseduration in minutes or hours i.e. 30 minutes or 1 hours. If not provided uses scheduler settings.
startfalsestart date to search slots. If not provided uses scheduler settings.
endfalseend date to search slots. If not provided uses scheduler settings.
buffer_timefalsebuffer in minutes or hours i.e. 30 minutes or 1 hours. If not provided uses scheduler buffer_time settings
round_to_minsfalseround start time in increment of 15, 30, 45 or 60 minutes
booking_windowfalseslots look up period in days, weeks or months i,e. 4 weeks. If not provided uses scheduler booking_window settings
resourcesfalselist of resources that falls under given scheduler
scheduler_idtruescheduler 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"
    }
}