Here you can see API endpoints related to customers.
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
Add customer
Create a customer.
Method
This endpoint accepts POST requests.
Path
/users/customers
Required Properties
The following properties are required.
Key | Type | Description |
---|---|---|
firstName | string | The first name of the customer |
lastName | string | The last name of the customer |
Optional Properties
The following properties are optional
Key | Type | Description |
---|---|---|
externalId | integer | The WP user id connected to the Amelia customer |
phone
|
string | The phone of the customer |
countryPhoneIso
|
string | The country phone ISO tied to the phone number |
email
|
string | The email of the customer. The email has to be unique. |
gender
|
string | The gender of the customer. Possible values: “male”, “female” |
birthday
|
string | The birthday of the customer. Format: “YYYY-MM-DD” |
note
|
string | The note of the customer. |
language
|
string | The default language of the customer |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data-raw '{ "firstName": "Amelia", "lastName": "Amelia", "externalId": 16, "phone": "+381601234567", "countryPhoneIso": "rs", "email": "[email protected]", "gender": "female", "birthday": "1990-05-17", "note": "Note about customer", "language": "en_GB" }'
{ "message": "Successfully added new user.", "data": { "user": { "id": 23, "firstName": "Amelia", "lastName": "Amelia", "birthday": { "date": "1990-05-17 13:38:49.000000", "timezone_type": 3, "timezone": "UTC" }, "email": "[email protected]", "phone": "+381601234567", "type": "customer", "status": "visible", "note": "Note about customer", "zoomUserId": null, "countryPhoneIso": "rs", "externalId": 16, "pictureFullPath": null, "pictureThumbPath": null, "translations": "{\"defaultLanguage\":\"en_GB\"}", "gender": "female" } } }
Update customer
Update customer details.
Method
This endpoint accepts POST requests.
Path
/users/customers/{{customer_id}}
Optional Properties
Send only the properties you want updated.
Key | Type | Description |
---|---|---|
firstName | string | The first name of the customer |
lastName | string | The last name of the customer |
externalId | integer | The WP user id connected to the Amelia customer |
phone
|
string | The phone of the customer |
countryPhoneIso
|
string | The country phone ISO tied to the phone number |
email
|
string | The email of the customer. The email has to be unique. |
gender
|
string | The gender of the customer. Possible values: “male”, “female” |
birthday
|
string | The birthday of the customer. Format: “YYYY-MM-DD” |
note
|
string | The note of the customer. |
language
|
string | The default language of the customer |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/23' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data-raw '{ "firstName": "Amelia", "lastName": "New Last Name", "externalId": 16, "phone": "+381601234567", "countryPhoneIso": "rs", "email": "[email protected]", "gender": "female", "birthday": "1990-05-17", "note": "Note about customer", "language": "en_GB" }'
{ "message": "Successfully updated user", "data": { "user": { "id": 23, "firstName": "Amelia", "lastName": "New Last Name", "birthday": { "date": "1990-05-17 13:40:33.000000", "timezone_type": 3, "timezone": "UTC" }, "email": "[email protected]", "phone": "+381601234567", "type": "customer", "status": "visible", "note": "Note about customer", "zoomUserId": null, "countryPhoneIso": "rs", "externalId": 16, "pictureFullPath": null, "pictureThumbPath": null, "translations": "{\"defaultLanguage\":\"en_GB\"}", "gender": "female" }, "is_wp_user": false } }
Get customer
Retrieve customer details.
Method
This endpoint accepts GET requests.
Path
/users/customers/{{customer_id}}
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/23' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved user", "data": { "user": { "id": 23, "firstName": "Amelia", "lastName": "New Last Name", "birthday": { "date": "1990-05-17 18:57:49.000000", "timezone_type": 3, "timezone": "UTC" }, "email": "[email protected]", "phone": "+381601234567", "type": "customer", "status": "visible", "note": "Note about customer", "zoomUserId": null, "countryPhoneIso": "rs", "externalId": 16, "pictureFullPath": null, "pictureThumbPath": null, "translations": "{\"defaultLanguage\":\"en_GB\"}", "gender": "female" } } }
Get customer delete effect
See if the customer can be deleted safely, based on future appointments.
Method
This endpoint accepts GET requests.
Path
/users/customers/effect/{{customer_id}}
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/effect/23' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved message.", "data": { "valid": false, "message": "Could not delete user.\n This user has 7 appointments in the future." } }
Get customers
Retrieve customers.
Method
This endpoint accepts GET requests.
Path
/customers
Optional Properties
You can use the following query parameters for paging/sorting the locations.
Key | Type | Description |
---|---|---|
page
|
integer | The page of the returned locations |
search | string | The search term. The lookup includes first name, last name, email and note |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers&page=1&search=amelia' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved users.", "data": { "users": [ { "id": 10, "status": "visible", "firstName": "Amelia", "lastName": "Test", "email": "[email protected]", "phone": "+381631652656", "countryPhoneIso": "rs", "gender": "", "externalId": 8, "translations": "{\"defaultLanguage\":\"en_US\"}", "birthday": "", "note": "", "lastAppointment": "2023-05-03 15:00:00", "totalAppointments": 11, "countPendingAppointments": "0", "wpName": "ameliatesttest-test", "wpUserPhotoUrl": "http://0.gravatar.com/avatar/6badf27972c65effc8ae7aefca4ff870?s=96&d=mm&r=g" }, { "id": 11, "status": "visible", "firstName": "Amelia", "lastName": "Test", "email": "[email protected]", "phone": "", "countryPhoneIso": "us", "gender": "", "externalId": 9, "translations": "{\"defaultLanguage\":\"en_US\"}", "birthday": "", "note": "", "lastAppointment": "2023-05-10 11:00:00", "totalAppointments": 28, "countPendingAppointments": "0", "wpName": "ameliatest-test", "wpUserPhotoUrl": "http://1.gravatar.com/avatar/79daf591cee9d124f8000c92eefe3f8c?s=96&d=mm&r=g" }, { "id": 16, "status": "visible", "firstName": "Amelia", "lastName": "Test", "email": "[email protected]", "phone": "", "countryPhoneIso": "us", "gender": "", "externalId": 12, "translations": "{\"defaultLanguage\":\"en_US\"}", "birthday": "", "note": "", "lastAppointment": "2023-05-09 11:00:00", "totalAppointments": 5, "countPendingAppointments": "1", "wpName": "[email protected]", "wpUserPhotoUrl": "http://0.gravatar.com/avatar/992f0843af11cecacfa1d6be9b0e623d?s=96&d=mm&r=g" } ], "filteredCount": 3, "totalCount": 16 } }
Delete customer
Delete customer.
Method
This endpoint accepts POST requests.
Path
/users/customers/delete/{{customer_id}}