Content
Here you can see API endpoints related to timeslots.
You can see all the API endpoints with examples of requests and responses in the Amelia API Postman collection which you can download here.
Authorization
All Amelia endpoints use an API key authorization, using the header property named “Amelia”.
Path
Amelia API paths start with: {{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Get timeslots
Get timeslots.
Method
This endpoint accepts GET requests.
Path
/slots
Query Parameters
You can use the following parameters.
Key | Type | Description |
---|---|---|
serviceId | integer | Service ID. Required. |
serviceDuration | integer | Service duration in seconds. Required. |
persons | integer | Number of persons. Required. |
providerIds | array | Array of employee IDs |
locationId | integer | Location ID |
startDateTime | string | From which date to retrieve timeslots. Sting in datetime format: “YYYY-MM-DD HH:mm” |
excludeAppointmentId | integer | Don’t include this appointment ID in the timeslot calculation. Used if appointment should be rescheduled. |
extras | array | An array of extras, since they can effect the timeslots |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/slots&locationId=2&serviceId=3&serviceDuration=1800&providerIds=3&persons=1&startDateTime=2023-09-25&extras=[]&excludeAppointmentId=null' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved free slots", "data": { "minimum": "2023-09-26 13:14", "maximum": "2023-10-16 13:14", "slots": { "2023-10-02": { "08:30": [ [ 3, 2 ] ], "09:00": [ [ 3, 2 ] ], "09:30": [ [ 3, 2 ] ], "10:00": [ [ 3, 2 ] ], "10:30": [ [ 3, 2 ] ], "11:00": [ [ 3, 2 ] ], "11:30": [ [ 3, 2 ] ], "12:00": [ [ 3, 2 ] ], "12:30": [ [ 3, 2 ] ], "13:00": [ [ 3, 2 ] ], "13:30": [ [ 3, 2 ] ], "14:00": [ [ 3, 2 ] ], "14:30": [ [ 3, 2 ] ] }, "2023-10-09": { "07:00": [ [ 3, 2 ] ], "07:30": [ [ 3, 2 ] ], "08:00": [ [ 3, 2 ] ], "08:30": [ [ 3, 2 ] ], "09:00": [ [ 3, 2 ] ], "09:30": [ [ 3, 2 ] ], "10:00": [ [ 3, 2 ] ], "10:30": [ [ 3, 2 ] ], "11:00": [ [ 3, 2 ] ], "11:30": [ [ 3, 2 ] ], "12:00": [ [ 3, 2 ] ], "12:30": [ [ 3, 2 ] ], "13:00": [ [ 3, 2 ] ], "13:30": [ [ 3, 2 ] ], "14:00": [ [ 3, 2 ] ], "14:30": [ [ 3, 2 ] ] }, "2023-10-16": { "07:00": [ [ 3, 2 ] ], "07:30": [ [ 3, 2 ] ], "08:00": [ [ 3, 2 ] ], "08:30": [ [ 3, 2 ] ], "09:00": [ [ 3, 2 ] ], "09:30": [ [ 3, 2 ] ], "10:00": [ [ 3, 2 ] ], "10:30": [ [ 3, 2 ] ], "11:00": [ [ 3, 2 ] ], "11:30": [ [ 3, 2 ] ], "12:00": [ [ 3, 2 ] ], "12:30": [ [ 3, 2 ] ], "13:00": [ [ 3, 2 ] ], "13:30": [ [ 3, 2 ] ], "14:00": [ [ 3, 2 ] ], "14:30": [ [ 3, 2 ] ] } }, "occupied": { "2023-09-26": { "07:00": [ [ 3, 4, 0, 6 ] ], "08:00": [ [ 3, 4, 0, 6 ] ], "09:30": [ [ 3, 4, 0, 2 ] ], "11:30": [ [ 3, 4, 0, 6 ] ] }, "2023-09-28": { "13:00": [ [ 3, 1, 0, 2 ] ] }, "2023-10-02": { "07:30": [ [ 3, 1, 0, 1 ] ] } }, "busyness": { "2023-10-02": 7, "2023-10-09": 0, "2023-10-16": 0 }, "lastProvider": null } }