User API
The User API enables secure authentication and management of administrative user accounts in your EverShop store. This API provides endpoints for user login, logout, and account management.
Login
Authenticates an administrative user and creates a session.
Field Name | Field Type | Required |
---|---|---|
string | Yes | |
password | string | Yes |
- cURL
- JavaScript
curl
-H "Accept: application/json"
https://<your domain>admin/user/login
fetch('https://<your domain>admin/user/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
});
{
"data": {
"sid": "auxzei_bEdRGT-HwfACmq7D5XyHf2l5M"
}
}
Response Properties
Property | Description |
---|---|
sid | Session ID token for authenticated requests |
Logout
Terminates the current user session.
- cURL
- JavaScript
curl
-H "Accept: application/json"
https://<your domain>admin/user/logout
fetch('https://<your domain>admin/user/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
});
{
"data": {}
}
Get Current User
Retrieves information about the currently authenticated user.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>admin/user/me
fetch('https://<your domain>admin/user/me', {
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
});
{
"data": {
"user_id": 1,
"uuid": "a89fe85c-d7de-4a79-9006-bfb4e0e49e8b",
"status": 1,
"email": "admin@example.com",
"name": "Admin User",
"role_id": 1,
"role_name": "Administrator",
"created_at": "2022-10-15 08:45:32",
"updated_at": "2023-02-07 10:22:45"
}
}
Create User
Creates a new administrative user account.
Field Name | Field Type | Required |
---|---|---|
name | string | Yes |
string | Yes | |
password | string | Yes |
password_confirm | string | Yes |
status | integer or string (0, 1, '0', '1') | Yes |
role_id | integer or string | Yes |
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>admin/users
fetch('https://<your domain>admin/users', {
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
});
{
"data": {
"user_id": 3,
"uuid": "b56f17d2-8a8f-42c3-9e42-7d6bfca8c205",
"status": 1,
"email": "staff@example.com",
"name": "Staff User",
"role_id": 2,
"created_at": "2023-07-12 14:32:18",
"updated_at": "2023-07-12 14:32:18"
}
}
Update User
Updates an existing administrative user account.
Field Name | Field Type | Required |
---|---|---|
name | string | No |
string | No | |
password | string | No |
password_confirm | string | No |
status | integer or string (0, 1, '0', '1') | No |
role_id | integer or string | No |
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>admin/users/{id}
fetch('https://<your domain>admin/users/{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
});
{
"data": {
"user_id": 3,
"uuid": "b56f17d2-8a8f-42c3-9e42-7d6bfca8c205",
"status": 1,
"email": "staff_updated@example.com",
"name": "Staff User Updated",
"role_id": 2,
"created_at": "2023-07-12 14:32:18",
"updated_at": "2023-07-12 15:45:22"
}
}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Yes | The UUID of the user to update |
Request Parameters
All parameters are optional for updates. Only include the parameters you want to modify. If updating the password, both password
and password_confirm
must be provided.
Delete User
Removes an administrative user account.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>admin/users/{id}
fetch('https://<your domain>admin/users/{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
});
{
"data": {
"user_id": 3,
"uuid": "b56f17d2-8a8f-42c3-9e42-7d6bfca8c205",
"status": 1,
"email": "staff@example.com",
"name": "Staff User",
"role_id": 2,
"created_at": "2023-07-12 14:32:18",
"updated_at": "2023-07-12 14:32:18"
}
}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Yes | The UUID of the user to delete |
Get User
Retrieves detailed information about a specific administrative user.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>admin/users/{id}
fetch('https://<your domain>admin/users/{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
});
{
"data": {
"user_id": 3,
"uuid": "b56f17d2-8a8f-42c3-9e42-7d6bfca8c205",
"status": 1,
"email": "staff@example.com",
"name": "Staff User",
"role_id": 2,
"role_name": "Staff",
"created_at": "2023-07-12 14:32:18",
"updated_at": "2023-07-12 14:32:18"
}
}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Yes | The UUID of the user to retrieve |
List Users
Retrieves a paginated list of administrative users.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>admin/users
fetch('https://<your domain>admin/users', {
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
});
{
"data": [
{
"user_id": 1,
"uuid": "a89fe85c-d7de-4a79-9006-bfb4e0e49e8b",
"status": 1,
"email": "admin@example.com",
"name": "Admin User",
"role_id": 1,
"role_name": "Administrator",
"created_at": "2022-10-15 08:45:32",
"updated_at": "2023-02-07 10:22:45"
},
{
"user_id": 3,
"uuid": "b56f17d2-8a8f-42c3-9e42-7d6bfca8c205",
"status": 1,
"email": "staff@example.com",
"name": "Staff User",
"role_id": 2,
"role_name": "Staff",
"created_at": "2023-07-12 14:32:18",
"updated_at": "2023-07-12 14:32:18"
}
],
"total": 2,
"currentPage": 1,
"limit": 20,
"links": [
{
"rel": "first",
"href": "/admin/users?page=1",
"action": "GET"
},
{
"rel": "last",
"href": "/admin/users?page=1",
"action": "GET"
}
]
}
Troubleshooting
Common Error Codes
Status Code | Description | Solution |
---|---|---|
400 | Bad Request | Check your request payload for invalid data |
401 | Unauthorized | User credentials are incorrect or session expired |
403 | Forbidden | User does not have permission for this operation |
404 | Not Found | The specified user ID does not exist |
409 | Conflict | Email address is already in use |
500 | Server Error | Contact support if the issue persists |