Slotify

Create a Customer

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

Authentication

This endpoint needs app token for authentication.

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

Query Parameters

This endpoint supports query parameters:

FieldValueDescription
includemeta,app,addresscan include meta, app and address for customer
searchemail, first_name, last_nameyou can search customer with their email, first or last name

Request Body:

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

Param NameRequiredDescription
emailtrueEmail for customer
first_nametrueFirst name of the customer
last_nametrueLast name of the customer
dobfalseDate of birth of customer
phonefalsePhone number of customer
notesfalseNotes for your customer
avatarfalseImage link to customer image
timezonefalseTimezone for your customer
genderfalseGender of your customer
addressfalseAddress object that contains city, country, state, address1 and postal_code

Example Request:

Following code shows how to send request to create a customer in Slotify api.

  • PHP
  • CURL
  • JSON
$endpoint = 'https://api.slotify.ca/v1/customers';
$owner_token = base64_encode('app_token'); 

$data = array(    
    'first_name' => 'John',
    'last_name' => 'Doe',    
    'email' => '[email protected]'
);

$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/customers \
  -H 'Authorization: Bearer <AppTokenEncodedBase64>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "first_name": "Dedric",
    "last_name": "Hayes",
    "email": "[email protected]"
}'
{
   "email": "[email protected]",
   "last_name": "Hayes",
   "first_name": "Dedric"
}

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": {
        "name": "John Doe",
        "dob": "1985-04-15",
        "uuid": "8d6b241b-bd03-408e-825c-51f35e06a1da",
        "phone": "699-868-4715",
        "email": "[email protected]",
        "notes": null,
        "gender": "unknown",
        "avatar": "https://cdn.fakercloud.com/avatars/djsherman_128.jpg",
        "timezone": "America/New_York",
        "last_name": "Doe",
        "first_name": "John",
        "created_at": "2024-04-29T23:15:14+00:00",
        "updated_at": "2024-04-29T23:15:14+00:00"
    }
}
{
    "success": false,
    "errors": {
        "last_name": "This field is required",
        "first_name": "This field is required",
        "email": "This field is required"
    }
}
{
    "code": 401,
    "message": "Unauthorized"
}