Create an Event

The following endpoint will help you create an event in Slotify using the create endpoint:

Authentication

This endpoint needs app token for authentication.

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

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
start_attruefuture start date in iso date time format
end_attruefuture end date in iso date time format
user_calendar_idfalseresource calendar id to add event or default calendar_id will be used

Example Request:

The following code shows how to send request to create a resource in Slotify API:

  • PHP
  • BASH
  • JSON
$apiEndpoint = 'https://api.slotify.ca/v1/events';
$memberToken = base64_encode("email:user_token");

$data = [
   "color" => "#fb923c", 
   "what" => "Sample Event", 
   "where" => "Catch the lightning", 
   "description" => "catch the light", 
   "end_at" => "2024-04-13T17:00:00+00:00", 
   "start_at" => "2024-04-13T09:00:00+00:00" 
]; 
 
$ch = curl_init($apiEndpoint);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer ' . $memberToken,
    '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 '{"color":"#fb923c","what":"Sample Event","where":"Catch the lightning","description":"catch the light","end_at":"2024-04-13T17:00:00+00:00","start_at":"2024-04-13T09:00:00+00:00"}' \
     https://api.slotify.ca/v1/events
{
    "color": "#fb923c",
    "what": "Sample Event",
    "where": "Catch the lightning",
    "description": "catch the light",
    "end_at": "2024-04-13T17:00:00+00:00",
    "start_at": "2024-04-13T09:00:00+00:00"
}

Example Response:

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

  • 201 Created
  • 400 Bad Request
{
    "success": true,
    "data": {
        "bookingUuid": null,
        "uuid": "23433a06-699f-4830-9be2-3c4db268a49a",
        "what": "Sample Event",
        "color": "#fb923c",
        "end_at": "2024-10-13T17:00:00+00:00",
        "location": null,
        "start_at": "2024-10-13T09:00:00+00:00",
        "created_at": "2024-10-01T22:43:43+00:00",
        "updated_at": "2024-10-01T22:43:43+00:00",
        "description": "catch the light"
    }
}
{
    "success": false,
    "errors": {
        "what": "The what field is required",
        "end_at": "Given date must follow ISO 8601 UTC format i.e. YYYY-MM-DDTHH:mm:ssZ",
        "event": "validation.event",
        "where": "The where field is required",
        "description": "The description field is required"
    }
}