http://localhost:8765/api
All protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Authenticate a user and receive a JWT token.
Endpoint: POST /auth/login
Request Body:
{
"username": "admin",
"password": "admin123"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"userInfo": {
"id": 1,
"username": "admin",
"fullName": "Administrator",
"role": "ADMIN",
"email": "admin@example.com"
}
}Status Codes:
200 OK- Login successful401 Unauthorized- Invalid credentials400 Bad Request- Missing required fields
Get information about the currently authenticated user.
Endpoint: GET /auth/me
Headers:
Authorization: Bearer <token>
Response:
{
"id": 1,
"username": "admin",
"fullName": "Administrator",
"role": "ADMIN",
"email": "admin@example.com",
"phoneNumber": "+1234567890"
}Retrieve a list of all users (Admin only).
Endpoint: GET /admin/users
Headers:
Authorization: Bearer <admin-token>
Query Parameters:
role(optional): Filter by role (ADMIN, SUPERVISOR, JANITOR)page(optional): Page number (default: 0)size(optional): Page size (default: 20)
Response:
{
"content": [
{
"id": 1,
"username": "janitor1",
"fullName": "John Doe",
"role": "JANITOR",
"email": "john@example.com",
"phoneNumber": "+1234567890",
"createdAt": "2025-01-01T00:00:00",
"active": true
}
],
"totalElements": 50,
"totalPages": 3,
"currentPage": 0
}Create a new user account (Admin only).
Endpoint: POST /admin/users
Headers:
Authorization: Bearer <admin-token>
Request Body:
{
"username": "janitor2",
"password": "password123",
"fullName": "Jane Smith",
"role": "JANITOR",
"email": "jane@example.com",
"phoneNumber": "+1234567891"
}Response:
{
"id": 2,
"username": "janitor2",
"fullName": "Jane Smith",
"role": "JANITOR",
"email": "jane@example.com",
"createdAt": "2025-10-12T10:30:00"
}Status Codes:
201 Created- User created successfully400 Bad Request- Validation error409 Conflict- Username already exists
Update user information (Admin only).
Endpoint: PUT /admin/users/{userId}
Request Body:
{
"fullName": "Jane Doe Smith",
"email": "jane.smith@example.com",
"phoneNumber": "+1234567892",
"role": "SUPERVISOR"
}Soft delete a user (Admin only).
Endpoint: DELETE /admin/users/{userId}
Response:
{
"message": "User deleted successfully"
}Retrieve tasks with optional filtering.
Endpoint: GET /tasks
Query Parameters:
status(optional): PENDING, IN_PROGRESS, COMPLETED, CANCELLEDpriority(optional): LOW, MEDIUM, HIGH, URGENTassignedTo(optional): User IDdateFrom(optional): Start date (ISO 8601)dateTo(optional): End date (ISO 8601)page(optional): Page numbersize(optional): Page size
Response:
{
"tasks": [
{
"id": 1,
"title": "Clean Office Floor 3",
"description": "Vacuum and mop all areas",
"location": "Building A, Floor 3",
"status": "PENDING",
"priority": "HIGH",
"assignedTo": {
"id": 5,
"fullName": "John Doe"
},
"createdBy": {
"id": 1,
"fullName": "Administrator"
},
"deadline": "2025-10-13T17:00:00",
"createdAt": "2025-10-12T09:00:00",
"updatedAt": "2025-10-12T09:00:00"
}
],
"stats": {
"total": 100,
"pending": 30,
"inProgress": 20,
"completed": 45,
"cancelled": 5
},
"totalPages": 10,
"currentPage": 0
}Retrieve detailed information about a specific task.
Endpoint: GET /tasks/{taskId}
Response:
{
"id": 1,
"title": "Clean Office Floor 3",
"description": "Vacuum and mop all areas. Pay special attention to conference rooms.",
"location": "Building A, Floor 3",
"status": "IN_PROGRESS",
"priority": "HIGH",
"assignedTo": {
"id": 5,
"fullName": "John Doe",
"email": "john@example.com"
},
"createdBy": {
"id": 1,
"fullName": "Administrator"
},
"deadline": "2025-10-13T17:00:00",
"startedAt": "2025-10-12T10:00:00",
"completedAt": null,
"completionNotes": null,
"images": [],
"createdAt": "2025-10-12T09:00:00",
"updatedAt": "2025-10-12T10:00:00"
}Create a new cleaning task (Admin/Supervisor only).
Endpoint: POST /tasks
Request Body:
{
"title": "Clean Lobby Area",
"description": "Full cleaning of main lobby including windows",
"location": "Building A, Lobby",
"priority": "MEDIUM",
"assignedToId": 5,
"deadline": "2025-10-14T15:00:00",
"estimatedDuration": 120
}Response:
{
"id": 101,
"title": "Clean Lobby Area",
"status": "PENDING",
"assignedTo": {
"id": 5,
"fullName": "John Doe"
},
"createdAt": "2025-10-12T11:00:00"
}Update the status of a task.
Endpoint: PUT /tasks/{taskId}/status
Request Body:
{
"status": "IN_PROGRESS",
"notes": "Started cleaning the lobby"
}Mark a task as completed with optional photos.
Endpoint: POST /tasks/{taskId}/complete
Request Body (multipart/form-data):
completionNotes: Task completed successfully. All areas cleaned.
images: [file1.jpg, file2.jpg]
Response:
{
"id": 1,
"status": "COMPLETED",
"completedAt": "2025-10-12T16:00:00",
"images": [
{
"id": 1,
"url": "/api/images/task_completion_1_abc123.jpg",
"uploadedAt": "2025-10-12T16:00:00"
}
]
}Delete a task (Admin only).
Endpoint: DELETE /tasks/{taskId}
Record employee check-in with timestamp.
Endpoint: POST /attendance/checkin
Request Body:
{
"location": "Office Building A",
"notes": "Arrived on time"
}Response:
{
"id": 1,
"userId": 5,
"checkInTime": "2025-10-12T08:00:00",
"location": "Office Building A",
"status": "CHECKED_IN",
"message": "Check-in successful"
}Status Codes:
200 OK- Check-in successful400 Bad Request- Already checked in
Record employee check-out.
Endpoint: POST /attendance/checkout
Request Body:
{
"notes": "Completed all assigned tasks"
}Response:
{
"id": 1,
"checkOutTime": "2025-10-12T17:00:00",
"workDuration": "9 hours 0 minutes",
"status": "CHECKED_OUT"
}Get current attendance status for the logged-in user.
Endpoint: GET /attendance/status
Response:
{
"status": "CHECKED_IN",
"checkInTime": "2025-10-12T08:00:00",
"duration": "3 hours 25 minutes",
"canCheckOut": true
}Retrieve attendance history for a user.
Endpoint: GET /attendance/history
Query Parameters:
userId(optional): User ID (Admin/Supervisor can view others)dateFrom(optional): Start datedateTo(optional): End datepage,size: Pagination
Response:
{
"records": [
{
"id": 1,
"date": "2025-10-12",
"checkInTime": "08:00:00",
"checkOutTime": "17:00:00",
"workDuration": "9h 0m",
"status": "PRESENT"
},
{
"id": 2,
"date": "2025-10-11",
"checkInTime": "08:15:00",
"checkOutTime": "17:05:00",
"workDuration": "8h 50m",
"status": "LATE"
}
],
"summary": {
"totalDays": 20,
"presentDays": 18,
"lateDays": 3,
"absentDays": 2
}
}Retrieve announcements for the current user.
Endpoint: GET /announcements
Query Parameters:
targetRole(optional): Filter by target roleunreadOnly(optional): true/false
Response:
{
"announcements": [
{
"id": 1,
"title": "Office Closed Tomorrow",
"content": "The office will be closed for maintenance.",
"priority": "HIGH",
"targetRole": "ALL",
"createdBy": {
"id": 1,
"fullName": "Administrator"
},
"createdAt": "2025-10-12T09:00:00",
"read": false
}
]
}Create a new announcement (Admin/Supervisor only).
Endpoint: POST /announcements
Request Body:
{
"title": "New Safety Procedures",
"content": "Please review the updated safety guidelines...",
"priority": "MEDIUM",
"targetRole": "JANITOR"
}Mark an announcement as read.
Endpoint: PUT /announcements/{announcementId}/read
Upload an image (task completion, profile, etc.).
Endpoint: POST /images/upload
Request (multipart/form-data):
file: image.jpg
entityType: TASK_COMPLETION
entityId: 1
Response:
{
"id": 1,
"url": "/api/images/task_completion_1_abc123.jpg",
"fileName": "task_completion_1_abc123.jpg",
"uploadedAt": "2025-10-12T14:30:00"
}Retrieve an image file.
Endpoint: GET /images/{imageName}
Response: Image file (JPEG, PNG, etc.)
Get detailed profile information.
Endpoint: GET /profile
Response:
{
"id": 5,
"username": "janitor1",
"fullName": "John Doe",
"email": "john@example.com",
"phoneNumber": "+1234567890",
"role": "JANITOR",
"avatar": "/api/images/profile_5_xyz789.jpg",
"joinedDate": "2025-01-01",
"stats": {
"tasksCompleted": 150,
"averageCompletionTime": "2.5 hours",
"attendanceRate": "95%"
}
}Update user profile information.
Endpoint: PUT /profile
Request Body:
{
"fullName": "John A. Doe",
"email": "john.doe@example.com",
"phoneNumber": "+1234567890"
}Change user password.
Endpoint: PUT /profile/password
Request Body:
{
"currentPassword": "oldpassword123",
"newPassword": "newpassword456"
}Upload a profile picture.
Endpoint: POST /profile/avatar
Request (multipart/form-data):
file: avatar.jpg
All endpoints may return the following error responses:
{
"timestamp": "2025-10-12T10:00:00",
"status": 400,
"error": "Bad Request",
"message": "Validation failed",
"errors": [
{
"field": "email",
"message": "Invalid email format"
}
]
}{
"timestamp": "2025-10-12T10:00:00",
"status": 401,
"error": "Unauthorized",
"message": "Invalid or expired token"
}{
"timestamp": "2025-10-12T10:00:00",
"status": 403,
"error": "Forbidden",
"message": "Access denied. Insufficient permissions"
}{
"timestamp": "2025-10-12T10:00:00",
"status": 404,
"error": "Not Found",
"message": "Task with ID 999 not found"
}{
"timestamp": "2025-10-12T10:00:00",
"status": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred"
}Currently, there are no rate limits imposed. This may change in future versions.
Endpoints that return lists support pagination with the following query parameters:
page: Page number (0-indexed, default: 0)size: Number of items per page (default: 20, max: 100)
Paginated responses include:
{
"content": [...],
"totalElements": 150,
"totalPages": 8,
"currentPage": 0,
"pageSize": 20
}# Login
curl -X POST http://localhost:8765/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}'
# Get tasks (with token)
curl -X GET http://localhost:8765/api/tasks \
-H "Authorization: Bearer YOUR_TOKEN_HERE"- Import the API endpoints
- Set up an environment variable for the base URL
- Create a variable for the JWT token
- Use pre-request scripts to automatically set the token
- Initial API release
- Authentication endpoints
- Task management
- Attendance tracking
- Announcements
- Image upload
- Profile management
For more information, please refer to the main README or contact the development team.