Customer API
Overview
The Customer API provides endpoints for managing customer accounts in your EverShop store. These endpoints allow you to create and manage customer profiles, handle authentication, and maintain customer data securely.
Endpoints
Create A Customer
Creates a new customer account in the system. This endpoint registers a new user with their basic information and credentials.
| Field Name | Field Type | Required |
|---|---|---|
| status | string or integer ('0', '1', 0, 1) | No |
| full_name | string | No |
| string | No | |
| password | string | No |
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/customers
fetch('https://<your domain>/api/customers', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"customer_id": 21,
"uuid": "e1b20098a66c11edb46b60d819134f39",
"status": 1,
"group_id": 1,
"email": "john.smith@example.com",
"full_name": "John Smith",
"created_at": "2023-02-07 14:18:05",
"updated_at": "2023-02-07 14:18:05",
"links": [
{
"rel": "customerGrid",
"href": "/admin/customers",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/customers/edit/e1b20098a66c11edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Update A Customer
Modifies an existing customer account. This endpoint allows you to update customer information such as email, name, or password.
| Field Name | Field Type | Required |
|---|---|---|
| status | string or integer ('0', '1', 0, 1) | No |
| full_name | string | No |
| string | No | |
| password | string | No |
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/customers/433ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/customers/433ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"customer_id": 21,
"uuid": "433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"status": 1,
"group_id": 1,
"email": "john.smith@example.com",
"full_name": "John A. Smith",
"created_at": "2023-02-07 14:18:05",
"updated_at": "2023-02-07 14:18:06",
"links": [
{
"rel": "customerGrid",
"href": "/admin/customers",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/customers/edit/433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Delete a Customer
Permanently removes a customer account from the system. This operation cannot be undone.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
https://<your domain>/api/customers/433ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/customers/433ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"customer_id": 21,
"uuid": "433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"status": 1,
"group_id": 1,
"email": "john.smith@example.com",
"full_name": "John A. Smith",
"created_at": "2023-02-07 14:18:05",
"updated_at": "2023-02-07 14:18:06"
}
}
Customer Addresses
Create Customer Address
Creates a new address for a customer.
| Field Name | Field Type | Required |
|---|---|---|
| full_name | string | No |
| telephone | string | No |
| address_1 | string | No |
| address_2 | string | No |
| city | string | No |
| province | string | No |
| country | string | No |
| postcode | string | No |
| is_default | boolean or integer | No |
- cURL
- JavaScript
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/customers/{customer_id}/addresses
fetch('https://<your domain>/api/customers/{customer_id}/addresses', {
headers: {
'Accept': 'application/json',
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"customer_address_id": 42,
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"customer_id": 21,
"full_name": "John Smith",
"address_1": "123 Main St",
"city": "New York",
"province": "NY",
"country": "US",
"postcode": "10001"
}
}
Update Customer Address
Updates an existing customer address.
| Field Name | Field Type | Required |
|---|---|---|
| full_name | string | No |
| telephone | string | No |
| address_1 | string | No |
| address_2 | string | No |
| city | string | No |
| province | string | No |
| country | string | No |
| postcode | string | No |
- cURL
- JavaScript
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/customers/{customer_id}/addresses/{address_id}
fetch('https://<your domain>/api/customers/{customer_id}/addresses/{address_id}', {
headers: {
'Accept': 'application/json',
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"customer_address_id": 42,
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"full_name": "John A. Smith",
"address_1": "456 Oak Ave"
}
}
Delete Customer Address
Removes a customer address.
- cURL
- JavaScript
curl
-H "Accept: application/json"
https://<your domain>/api/customers/{customer_id}/addresses/{address_id}
fetch('https://<your domain>/api/customers/{customer_id}/addresses/{address_id}', {
headers: {
'Accept': 'application/json',
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"customer_address_id": 42,
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
Password Management
Reset Password
Sends a password reset email to the customer.
| Field Name | Field Type | Required |
|---|---|---|
| string | Yes |
- cURL
- JavaScript
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/customers/reset-password
fetch('https://<your domain>/api/customers/reset-password', {
headers: {
'Accept': 'application/json',
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"success": true
}
}
Update Password
Updates a customer's password using a reset token received via email.
| Field Name | Field Type | Required |
|---|---|---|
| password | string | Yes |
| token | string | Yes |
- cURL
- JavaScript
curl
-H "Accept: application/json"
--data-raw "<JSON DATA>"
https://<your domain>/api/customers/password
fetch('https://<your domain>/api/customers/password', {
headers: {
'Accept': 'application/json',
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"success": true
}
}
Get Customer Data with GraphQL
EverShop uses GraphQL for querying customer data. For detailed information on how to query customers, refer to the GraphQL API documentation.