Slotify

Create an Event

Following endpoint will help you create a event in Slotify using create endpoint:

Authentication

This endpoint needs app token for authentication.

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

Query Parameters

This endpoint supports query parameters:

FieldValueDescription
includecalendarshows user calendar for this event
searchstart_at, end_atsearch events by start and end dates

Request Body:

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

Param NameRequiredDescription
colorfalsecolor for the event
whattrueevent name or purpose
wheretruelocation of the event
descriptiontruedescription of the event
event.start_attruestart date in iso date time format
event.end_attrueend date in iso date time format
user_calendar_idtrueresource calendar id to add event 

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/events';
$apiToken = base64_encode("app-token");

$data = array(
    'name' => 'John Doe',
    'email' => '[email protected]',
    'role' => 'member', // or 'asset' depending on the resource type
    'timezone' => 'America/New_York'
);

$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 '{"name":"John Doe","email":"[email protected]","role":"member","timezone":"America/Toronto"}' \
     https://api.slotify.ca/v1/events
{
    "role": "member",
    "name": "John Doe",
    "email": "[email protected]",
    "timezone": "America/Toronto"
}

Example Response:

Following response will be provided by Slotify server when this endpoint is called:

  • 201 Created
  • 400 Bad Request
{
    "success": true,
    "data": {
            "uuid": "cdd5c031-6203-407a-9977-34288370a398",
            "what": "Appointment with Dr. John Doe",
            "color": '#ffffff',
            "end_at": "2024-09-20T17:00:00+00:00",
            "location": {
                "type": "address",
                "value": "123 ABC Road"
            },
            "start_at": "2024-09-20T17:00:00+00:00",
            "created_at": "2024-09-03T15:39:33+00:00",
            "updated_at": "2024-09-03T15:39:33+00:00",
            "description": "Appointment with Dr. John Doe"
   }
}
{
    "success": false,
    "errors": {
        "name": "This field is required",
        "timezone": "This field is required",
        "email": "This field is required",
        "role": "This field is required",
        "password": "This field is required",
        "confirm_password": "This field is required"
    }
}