Create a Scheduler
Following endpoint will help you create a resource in Slotify using scheduler create endpoint:
Authentication
This endpoint needs app token for authentication.
Method | POST |
---|---|
Endpoint | v1/schedulers |
Headers | Accept: application/json |
Authorization: Bearer <base64_encoded_token> | |
Token type | App |
Query Parameters
This endpoint supports query parameters:
Field | Value | Description |
---|---|---|
include | app,fields,services,resources,workflow,rules | show app,fields,services,resources,workflow,rules |
search | name, mode, graph | search by name, mode or graph |
Request Body:
This endpoint requires following parameters to be sent via post body:
Param Name | Required | Description |
---|---|---|
color | true | hexcode for color |
duration | true | duration unit i.e. minutes or hours |
min_notice | true | unit in either hours or days |
buffer_time | true | duration unit i.e. minutes or hours |
slot_capacity | true | allowed number of bookings per time slot |
perday_capacity | false | total number of bookings per day |
booking_window | true | duration unit in either days, weeks or months |
graph | true | booking graph i.e. instant, instant_group, confirm_decline |
min_cancellation | true | duration unit i.e. minutes or hours or days |
name | true | name of the scheduler |
mode | true | algorithm that is used to search for resource availability i.e. round_robin, prioritized, mutual |
rules | false | Scheduler constraints |
Read more here on scheduler constraints.
Example Request:
Following code shows how to send request to create a scheduler in Slotify api.
- PHP
- BASH
- JSON
$apiEndpoint = 'https://api.slotify.ca/v1/schedulers';
$apiToken = base64_encode('YOUR_APP_TOKEN');
$data = array(
"graph" => "instant",
"color" => "#84cc16", // Updated
"slot_capacity" => 5, // Updated
"mode" => "round_robin",
"time_format" => "24hr",
"min_notice" => "1 days", // Updated
"duration" => "30 minutes",
"buffer_time" => "0 minutes",
"booking_window" => "4 weeks", // Updated
"min_cancellation" => "1 days", // Updated
"name" => "Instant Scheduler", // Updated
"slug" => "instant", // New
"unit_price" => 0, // New
"perday_capacity" => 500, // New
"timezone" => "America/Toronto", // New
"rules" => array( // New
array(
"rule" => "hours",
"type" => "allowed",
"times" => array(
array(
"start" => "09:00",
"end" => "17:00"
)
)
)
),
"resources" => array( // New
"1d9ca4d0-af0e-41a5-8188-c1bba0183505"
),
"fields" => array( // New
array(
"options" => array(),
"hidden" => false,
"is_default" => true,
"is_required" => false,
"slug" => "first_name",
"title" => "First Name",
"placeholder" => "First Name",
"type" => "text"
),
array(
"options" => array(),
"hidden" => false,
"is_default" => true,
"is_required" => false,
"slug" => "last_name",
"title" => "Last Name",
"placeholder" => "Last Name",
"type" => "text"
),
array(
"options" => array(),
"hidden" => false,
"is_default" => true,
"is_required" => false,
"slug" => "email",
"title" => "Email Address",
"placeholder" => "Email",
"type" => "text"
)
),
"event" => array( // New
"what" => "Meeting with John Doe",
"location" => array(
"type" => "google_meet"
),
"description" => "Let's meet online and discuss details",
"start_at" => "2024-09-03"
)
);
$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 " \
-H "Content-Type: application/json" \
-d '{
"graph": "instant",
"color": "#84cc16",
"slot_capacity": 5,
"mode": "round_robin",
"min_notice": "1 days",
"duration": "30 minutes",
"buffer_time": "0 minutes",
"booking_window": "4 weeks",
"min_cancellation": "1 days",
"name": "Instant Scheduler",
"slug": "instant",
"unit_price": 0,
"perday_capacity": 500,
"timezone": "America/Toronto",
"rules": [
{
"rule": "hours",
"type": "allowed",
"times": [
{
"start": "09:00",
"end": "17:00"
}
]
}
],
"resources": [
"1d9ca4d0-af0e-41a5-8188-c1bba0183505"
],
"fields": [
{
"options": {},
"hidden": false,
"is_default": true,
"is_required": false,
"slug": "first_name",
"title": "First Name",
"placeholder": "First Name",
"type": "text"
},
{
"options": {},
"hidden": false,
"is_default": true,
"is_required": false,
"slug": "last_name",
"title": "Last Name",
"placeholder": "Last Name",
"type": "text"
},
{
"options": {},
"hidden": false,
"is_default": true,
"is_required": false,
"slug": "email",
"title": "Email Address",
"placeholder": "Email",
"type": "text"
}
],
"event": {
"what": "Meeting with John Doe",
"location": {
"type": "google_meet"
},
"description": "Let\'s meet online and discuss details",
"start_at": "2024-09-03"
}
}' \
https://api.slotify.ca/v1/schedulers
{
"color": "#84cc16",
"name": "Instant Scheduler",
"slug": "instant",
"graph": "instant",
"unit_price": 0,
"slot_capacity": 5,
"perday_capacity": 500,
"duration": "30 minutes",
"booking_window": "4 weeks",
"min_notice": "1 days",
"min_cancellation": "1 days",
"timezone": "America/Toronto",
"buffer_time": "0 minutes",
"rules": [
{
"rule": "hours",
"type": "allowed",
"times": [
{
"start": "09:00",
"end": "17:00"
}
]
}
],
"mode": "round_robin",
"resources": [
"1d9ca4d0-af0e-41a5-8188-c1bba0183505"
],
"fields": [
{
"options": {},
"hidden": false,
"is_default": true,
"is_required": false,
"slug": "first_name",
"title": "First Name",
"placeholder": "First Name",
"type": "text"
},
{
"options": {},
"hidden": false,
"is_default": true,
"is_required": false,
"slug": "last_name",
"title": "Last Name",
"placeholder": "Last Name",
"type": "text"
},
{
"options": {},
"hidden": false,
"is_default": true,
"is_required": false,
"slug": "email",
"title": "Email Address",
"placeholder": "Email",
"type": "text"
}
],
"event": {
"what": "Meeting with John Doe",
"location": {
"type": "google_meet"
},
"description": "Let's meet online and discuss details",
"start_at": "2024-09-03"
}
}
Example Response:
Following response will be provided by Slotify server when this endpoint is called:
- 201 Created
- 400 Bad Request
{
"success": true,
"data": {
"slug": "instant",
"mode": "round_robin",
"uuid": "28f0b45d-d14f-438f-b59a-833a57a31147",
"name": "Instant Scheduler",
"color": "#84cc16",
"event": {
"what": "Meeting with John Doe",
"location": {
"type": "google_meet"
},
"start_at": "2024-09-03",
"description": "Let's meet online and discuss details"
},
"graph": "instant",
"duration": "30 minutes",
"timezone": "America/Toronto",
"unit_price": 0,
"min_notice": "1 days",
"created_at": "2024-09-03T15:51:25+00:00",
"updated_at": "2024-09-03T15:51:25+00:00",
"buffer_time": "0 minutes",
"time_format": null,
"service_flow": "auto",
"slot_capacity": 5,
"booking_window": "4 weeks",
"perday_capacity": 500,
"min_cancellation": "1 days",
"resources": [
{
"uuid": "1d9ca4d0-af0e-41a5-8188-c1bba0183505",
"name": "John Doe",
"role": "member",
"email": "[email protected]",
"avatar": null,
"priority": null,
"timezone": "America/Toronto",
"created_at": null,
"updated_at": null
}
]
}
}
{
"success": false,
"errors": {
"color": "This field is required",
"duration": "Invalid duration",
"min_notice": "Invalid min notice format",
"buffer_time": "Invalid buffer time format",
"slot_capacity": "This field is required",
"booking_window": "Invalid booking window format",
"graph": "This field is required",
"slug": "This field is required",
"min_cancellation": "Invalid format provided for min cancellation period",
"name": "This field is required",
"mode": "This field is required",
"event": {
"what": "This field is required",
"start_at": "This field is required",
"description": "This field is required",
"location": {
"type": "This field is required"
}
}
}
}