Employees
List All Employees
curl -X GET "${VITE_BASE_URL}/employee" \
-H "Authorization: Bearer <token>"
Retrieves a list of all employees.
Authentication Required: Yes
Response
Array of employee objectsEmployee unique identifier
Employment status (active, inactive)
{
"data": [
{
"id": 1,
"first_name": "Juan",
"last_name": "Pérez",
"email": "[email protected]",
"phone": "+52 55 1234 5678",
"position": "Sales Manager",
"department": "Sales",
"hire_date": "2023-01-15",
"status": "active",
"photo_url": "https://example.com/photos/juan.jpg"
}
]
}
Get Employee by ID
curl -X GET "${VITE_BASE_URL}/employee/1" \
-H "Authorization: Bearer <token>"
Retrieves a single employee by ID.
Authentication Required: Yes
Path Parameters
Response
Employee unique identifier
Employee salary (if authorized)
Associated user account if exists
{
"id": 1,
"first_name": "Juan",
"last_name": "Pérez",
"email": "[email protected]",
"phone": "+52 55 1234 5678",
"position": "Sales Manager",
"department": "Sales",
"hire_date": "2023-01-15",
"salary": 50000.00,
"status": "active",
"photo_url": "https://example.com/photos/juan.jpg",
"user": {
"id": 10,
"email": "[email protected]",
"role_id": 3
}
}
Create Employee
curl -X POST "${VITE_BASE_URL}/employee" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: multipart/form-data" \
-F "first_name=María" \
-F "last_name=García" \
-F "[email protected]" \
-F "phone=+52 55 9876 5432" \
-F "position=Marketing Coordinator" \
-F "department=Marketing" \
-F "hire_date=2024-03-01" \
-F "salary=35000" \
-F "photo=@/path/to/photo.jpg"
Creates a new employee record.
Authentication Required: Yes
Content-Type: multipart/form-data
Request Body
Date of hire (YYYY-MM-DD format)
Employment status (default: “active”)
Response
{
"id": 15,
"message": "Employee created successfully"
}
Update Employee
curl -X PUT "${VITE_BASE_URL}/employee/1" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: multipart/form-data" \
-F "position=Senior Sales Manager" \
-F "salary=60000"
Updates an existing employee record.
Authentication Required: Yes
Content-Type: multipart/form-data
Path Parameters
Request Body
Same fields as Create Employee (all optional for updates)
Response
{
"message": "Employee updated successfully"
}
Delete Employee
curl -X DELETE "${VITE_BASE_URL}/employee/1" \
-H "Authorization: Bearer <token>"
Deletes an employee record.
Authentication Required: Yes
Path Parameters
Response
{
"message": "Employee deleted successfully"
}