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: asid=<your admin cookie>"
https://<your domain>/api/customers
fetch('https://<your domain>/api/customers', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.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: asid=<your admin cookie>"
https://<your domain>/api/customers/{id}
fetch('https://<your domain>/api/customers/{id}', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.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: asid=<your admin cookie>"
https://<your domain>/api/customers/{id}
fetch('https://<your domain>/api/customers/{id}', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.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"
}
}
Login
Use this endpoint to login a customer.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
string | Yes | |
password | string | Yes |
POST/customer/login
- cURL
- JavaScript
curl
-H "Accept: application/json"
https://<your domain>/customer/login
fetch('https://<your domain>/customer/login', {
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
});
Sample Of Response
{
"data": {
"sid": "09d34c21-4af3-4db8-a38b-335ebf6d45fa"
}
}
Logout
Use this endpoint to logout a customer.
Request Schema (application/json)
No request body requiredPOST/customers/logout
- cURL
- JavaScript
curl
-H "Accept: application/json"
https://<your domain>/customers/logout
fetch('https://<your domain>/customers/logout', {
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
});
Sample Of Response
{
"data": {}
}