Customer API
Use the REST API to interact with EverShop customers.
Create a customer
Use this endpoint to create a customer.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
status | string or integer ('0', '1', 0, 1) | No |
string | Yes | |
password | string | Yes |
full_name | string | Yes |
POST/api/customers
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: admin_token=<your jwt token id>"
https://<your domain>/api/customers
fetch('https://<your domain>/api/customers', {
headers: {
'Accept': 'application/json',
'Cookie': 'admin_token=<your jwt token id>'
}
})
.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": "wkVPyU6LG9nQ1kwTn3Or@email.com",
"full_name": "wkVPyU6LG9nQ1kwTn3Or",
"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
Use this endpoint to update an customer.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
string | No | |
password | string | No |
full_name | string | No |
PATCH/api/customers/{id}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: admin_token=<your jwt token id>"
https://<your domain>/api/customers/{id}
fetch('https://<your domain>/api/customers/{id}', {
headers: {
'Accept': 'application/json',
'Cookie': 'admin_token=<your jwt token id>'
}
})
.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": "Ssbvz5pUbOXPCFv5WDrd@gmail.com",
"full_name": "abc",
"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/e1b20098a66c11edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Delete a customer
Use this endpoint to delete an customer.
Request Schema (application/json)
No request body requiredDELETE/api/customers/{id}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: admin_token=<your jwt token id>"
https://<your domain>/api/customers/{id}
fetch('https://<your domain>/api/customers/{id}', {
headers: {
'Accept': 'application/json',
'Cookie': 'admin_token=<your jwt token id>'
}
})
.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": "Ssbvz5pUbOXPCFv5WDrd@gmail.com",
"full_name": "abc",
"created_at": "2023-02-07 14:18:05",
"updated_at": "2023-02-07 14:18:06"
}
}
Create a customer session
Use this endpoint to create a customer session (login).
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
string | Yes | |
password | string | Yes |
POST/api/customers/sessions
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: admin_token=<your jwt token id>"
https://<your domain>/api/customers/sessions
fetch('https://<your domain>/api/customers/sessions', {
headers: {
'Accept': 'application/json',
'Cookie': 'admin_token=<your jwt token id>'
}
})
.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": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lciI6eyJjdXN0b21lcklkIjoyMiwidXVpZCI6ImQ3YTVlOGI1YTY3MzExZWRiNDZiNjBkODE5MTM0ZjM5Iiwic3RhdHVzIjoxLCJncm91cElkIjoxLCJlbWFpbCI6ImtjMDRBY25MNHU2dUNldDJoSFVxQGVtYWlsLmNvbSIsImZ1bGxOYW1lIjoia2MwNEFjbkw0dTZ1Q2V0MmhIVXEiLCJjcmVhdGVkQXQiOiIyMDIzLTAyLTA3IDE1OjA3OjU1IiwidXBkYXRlZEF0IjoiMjAyMy0wMi0wNyAxNTowNzo1NSJ9LCJzaWQiOiIwOWQzNGMyMS00YWYzLTRkYjgtYTM4Yi0zMzVlYmY2ZDQ1ZmEiLCJpYXQiOjE2NzU2NDk2MTgsImV4cCI6MTY3NTgyMjQxOH0.KVViMcH55nQKHGffvNaVzEENAYS4kEh2xz-KfHHjOWA",
"sid": "09d34c21-4af3-4db8-a38b-335ebf6d45fa"
}
}
Delete a customer session
Use this endpoint to delete a customer session (logout).
Request Schema (application/json)
No request body requiredPOST/api/customers/sessions/{ids}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: admin_token=<your jwt token id>"
https://<your domain>/api/customers/sessions/{ids}
fetch('https://<your domain>/api/customers/sessions/{ids}', {
headers: {
'Accept': 'application/json',
'Cookie': 'admin_token=<your jwt token id>'
}
})
.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": {}
}