Create a Customer

The following endpoint will help you create a customer in Slotify using the customer create endpoint:

Authentication

This endpoint needs an 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 the following parameters to be sent via the 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 (note that this must be in E.164 format)
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:

The following code shows how to send a request to create a customer in the 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' => 'john.doe@yahoo.com'
);

$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": "Valentine_Keeling@yahoo.com"
}'
{
   "email": "Valentine_Keeling@yahoo.com",
   "last_name": "Hayes",
   "first_name": "Dedric"
}

Example Response:

The 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": "john.doe@yahoo.com",
        "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"
}