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.
Request Schema (application/json)
| Field Name | Field Type | Required |
|---|---|---|
| status | string or integer ('0', '1', 0, 1) | No |
| full_name | string | No |
| string | No | |
| password | string | No |
POST/api/customers
- 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
});
Sample Of Response
{
"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.
Request Schema (application/json)
| Field Name | Field Type | Required |
|---|---|---|
| status | string or integer ('0', '1', 0, 1) | No |
| full_name | string | No |
| string | No | |
| password | string | No |
PATCH/api/customers/433ba97f-8be7-4be9-be3f-a9f341f2b89f
- 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
});
Sample Of Response
{
"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.
Request Schema (application/json)
No request body requiredDELETE/api/customers/433ba97f-8be7-4be9-be3f-a9f341f2b89f
- 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
});
Sample Of Response
{
"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"
}
}
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.