Create an App
The Slotify API allows you to create an App that represents a business location, department, or entity. This is done using the POST
method. Each App serves as a container for bookings, resources, and other related data specific to a particular business context.
Authentication
Use owner token for this endpoint.
Method | POST |
---|---|
Endpoint | v1/apps |
Headers | Accept: application/json |
Authorization: Bearer <base64_encoded_token> | |
Token type | Owner |
Query Parameters
This endpoint supports query parameters:
Field | Value | Description |
---|---|---|
include | meta | Fetches metadata for this app |
search | name, slug | name and slug can be used as search parameter to filter app results. |
Request Body:
This endpoint requires following parameters to be sent via post body:
Param Name | Required | Description |
---|---|---|
slug | true | Unique app slug |
name | true | Unique name of the app |
description | true | Description for your app |
meta | false | Array with key value pair to store additional metadata for your app |
Example Request:
Following code shows how to send request to create an app in Slotify api.
- php
- curl
- json
$endpoint = 'https://api.slotify.ca/v1/apps';
$owner_token = base64_encode('email:token');
$data = array(
'slug' => 'my-app',
'name' => 'My Scheduling App',
'description' => 'My awesome booking app',
'meta' => [
'store_id' => 12345
]
);
$post_data = json_encode($data);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $endpoint,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer ' . $owner_token,
'Accept: application/json',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
if(curl_errno($curl)) {
echo 'Error: ' . curl_error($curl);
} else {
echo $response;
}
curl_close($curl);
curl -X POST \
https://api.slotify.ca/v1/apps \
-H 'Authorization: Bearer ' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"slug": "my-app",
"name": "My Scheduling App",
"description": "My awesome booking app",
"meta": {
"store_id": "12345"
}
}'
{
"slug": "my-app",
"name": "My Scheduling App",
"description": "My awesome booking app",
"meta": {
"store_id": "12345"
}
}
Example Response:
Following response will be provided by Slotify server when this endpoint is called:
- 201 Created
- 400 Bad Request
- 401 Unauthorized
{
"success": true,
"data": {
"slug": "my-app",
"name": "My Scheduling App",
"uuid": "bc7b15f9-2573-4aaa-be09-44d6c6f9c62c",
"token": "cecd3370-15f9-44b4-88e7-fc772eab3be6",
"created_at": "2024-04-29T18:52:52+00:00",
"updated_at": "2024-04-29T18:52:52+00:00",
"description": "My awesome booking app"
}
}
{
"success": false,
"errors": {
"slug": "This field is required",
"description": "This field is required",
"name": "This field is required"
}
}
{
"code": 401,
"message": "Unauthorized"
}