๐Ÿญ Mining Greasing API Documentation

Complete API Documentation for Mining Equipment Greasing Application

Base URL: https://sbilaravel.web.id/api | Version: 2.0.0 | Laravel: 10.49.1

๐Ÿ“‹ API Information

  • Authentication: Bearer Token (Laravel Sanctum)
  • Content-Type: application/json
  • Pagination: Supported with per_page parameter
  • Search: Case-insensitive LIKE queries

๐Ÿ” Authentication

โš ๏ธ Important: Most endpoints require authentication. Get your token by calling the login endpoint first.

POST /api/login Public

Description: Login to get authentication token

๐Ÿ“ค Request Body:

{ "email": "supervisor@miningcompany.com", "password": "password" }

๐Ÿ“ฅ Success Response (200):

{ "success": true, "message": "Login successful", "data": { "user": { "id": 1, "name": "Ahmad Supervisor", "email": "supervisor@miningcompany.com", "role": "supervisor" }, "token": "1|abcd1234efgh5678ijkl9012mnop3456" } }

GET /api/profile Auth Required

Description: Get current user profile

Header: Authorization: Bearer {token}

POST /api/logout Auth Required

Description: Logout and revoke token

๐Ÿ‘ฅ Users Management

GET /api/users?per_page=10 Auth Required

Description: Get all users with pagination

Query Parameters: per_page (optional, default: 10)

POST /api/users Auth Required

Description: Create new user

๐Ÿ“ค Request Body:

{ "name": "David Operator", "email": "david@miningcompany.com", "password": "password123", "role": "operator" }

๐Ÿ“‹ Required Fields:

Field Type Required Description
name string Yes Full name
email string Yes Email (unique)
password string Yes Min 8 characters
role string Yes supervisor, operator, technician, admin

GET /api/users/{id} Auth Required

Description: Get user by ID

PUT /api/users/{id} Auth Required

Description: Update user

DELETE /api/users/{id} Auth Required

Description: Delete user

GET /api/users/search/name?name=Ahmad Auth Required

Description: Search users by name

Parameters: name (required), per_page (optional)

๐Ÿญ Areas Management

GET /api/area/test Public

Description: Test area API

GET /api/areas?per_page=10 Auth Required

Description: Get all areas with pagination

POST /api/areas Auth Required

Description: Create new area

๐Ÿ“ค Request Body:

{ "name_area": "Mining Pit Area A", "route": "Main Mining Route", "location": "North Sector" }

๐Ÿ“‹ Required Fields:

Field Type Required Description
name_area string Yes Area name (unique)
route string Yes Route information
location string Yes Location description

GET /api/areas/{id} Auth Required

Description: Get area by ID

PUT /api/areas/{id} Auth Required

Description: Update area

DELETE /api/areas/{id} Auth Required

Description: Delete area

GET /api/areas/search/name?name_area=Mining Auth Required

Description: Search areas by name

Parameters: name_area (required, min 2 chars), per_page (optional)

GET /api/areas/search/route?route=Main Auth Required

Description: Search areas by route

Parameters: route (required, min 2 chars), per_page (optional)

GET /api/areas/search/location?location=North Auth Required

Description: Search areas by location

Parameters: location (required, min 2 chars), per_page (optional)

GET /api/areas/by-location Auth Required

Description: Get areas grouped by location with counts

GET /api/areas/distinct-locations Auth Required

Description: Get list of distinct locations

GET /api/areas/statistics Auth Required

Description: Get area statistics and breakdown by location and route

๐Ÿ“ฅ Response Example:

{ "success": true, "message": "Area statistics retrieved successfully", "data": { "total_areas": 15, "total_locations": 3, "total_routes": 5, "location_breakdown": [ {"location": "North Sector", "count": 8}, {"location": "South Sector", "count": 5}, {"location": "East Sector", "count": 2} ], "route_breakdown": [ {"route": "Main Mining Route", "count": 6}, {"route": "Secondary Route", "count": 4} ] } }

โš™๏ธ Machines Management

GET /api/machine/test Public

Description: Test machine API

Response:

{
    "success": true,
    "message": "Machine API is working perfectly!",
    "timestamp": "2025-11-12T17:21:15.818264Z",
    "endpoints": {
        "GET /api/machines": "Get all machines with pagination",
        "POST /api/machines": "Create new machine",
        "GET /api/machines/{id}": "Get specific machine",
        "PUT /api/machines/{id}": "Update machine",
        "DELETE /api/machines/{id}": "Delete machine",
        "GET /api/machines/search/hac": "Search by HAC",
        "GET /api/machines/search/part": "Search by part machine",
        "GET /api/machines/by-area": "Get machines by area",
        "GET /api/machines/statistics": "Get machine statistics"
    }
}

GET /api/machines?per_page=10 Auth Required

Description: Get all machines with pagination

Response:

{
    "success": true,
    "message": "Machines retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "hac": "EX001",
                "part_machine": "Excavator Bucket",
                "area_id": 1,
                "description": "Heavy duty excavator for mining operations",
                "created_at": "2025-11-12T10:00:00Z",
                "updated_at": "2025-11-12T10:00:00Z",
                "area": {
                    "id": 1,
                    "name_area": "Mining Area 1",
                    "route": "Route A",
                    "location": "North Section"
                }
            }
        ],
        "per_page": 10,
        "total": 8
    }
}

POST /api/machines Auth Required

Description: Create a new machine

Request Body:

{
    "hac": "DT009",
    "part_machine": "Dump Truck Transmission",
    "area_id": 2,
    "description": "Heavy duty transmission for mining dump truck"
}

Response:

{
    "success": true,
    "message": "Machine created successfully",
    "data": {
        "id": 9,
        "hac": "DT009",
        "part_machine": "Dump Truck Transmission",
        "area_id": 2,
        "description": "Heavy duty transmission for mining dump truck",
        "created_at": "2025-11-12T17:30:00Z",
        "updated_at": "2025-11-12T17:30:00Z",
        "area": {
            "id": 2,
            "name_area": "Mining Area 2",
            "route": "Route B",
            "location": "South Section"
        }
    }
}

GET /api/machines/{id} Auth Required

Description: Get specific machine by ID

Response:

{
    "success": true,
    "message": "Machine retrieved successfully",
    "data": {
        "id": 1,
        "hac": "EX001",
        "part_machine": "Excavator Bucket",
        "area_id": 1,
        "description": "Heavy duty excavator for mining operations",
        "area": {
            "id": 1,
            "name_area": "Mining Area 1",
            "route": "Route A",
            "location": "North Section"
        }
    }
}

PUT /api/machines/{id} Auth Required

Description: Update machine

Request Body:

{
    "hac": "EX001-UPD",
    "part_machine": "Excavator Bucket Updated",
    "area_id": 1,
    "description": "Updated heavy duty excavator for mining operations"
}

DELETE /api/machines/{id} Auth Required

Description: Delete machine

Response:

{
    "success": true,
    "message": "Machine deleted successfully"
}

GET /api/machines/search/hac?hac=EX Auth Required

Description: Search machines by HAC code

Response:

{
    "success": true,
    "message": "Machines search completed",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "hac": "EX001",
                "part_machine": "Excavator Bucket",
                "area": {
                    "name_area": "Mining Area 1"
                }
            }
        ]
    }
}

GET /api/machines/search/part?part_machine=Excavator Auth Required

Description: Search machines by part machine name

GET /api/machines/by-area?area_id=1 Auth Required

Description: Get machines by area ID

GET /api/machines/statistics Auth Required

Description: Get machine statistics

Response:

{
    "success": true,
    "message": "Machine statistics retrieved successfully",
    "data": {
        "total_machines": 8,
        "machines_by_area": [
            {
                "area_id": 1,
                "total": 2,
                "area": {
                    "id": 1,
                    "name_area": "Mining Area 1"
                }
            }
        ]
    }
}

๐Ÿ“‹ Tasks Management

GET /api/task/test Public

Description: Test task API

Response:

{
    "success": true,
    "message": "Task API is working perfectly!",
    "timestamp": "2025-11-12T17:42:47.377323Z",
    "endpoints": {
        "GET /api/tasks": "Get all tasks with pagination",
        "POST /api/tasks": "Create new task",
        "GET /api/tasks/{id}": "Get specific task",
        "PUT /api/tasks/{id}": "Update task",
        "DELETE /api/tasks/{id}": "Delete task",
        "GET /api/tasks/search/name": "Search by task name",
        "GET /api/tasks/by-machine": "Get tasks by machine",
        "GET /api/tasks/by-lubricant": "Get tasks by lubricant",
        "GET /api/tasks/statistics": "Get task statistics"
    }
}

GET /api/tasks?per_page=10 Auth Required

Description: Get all tasks with pagination

Response:

{
    "success": true,
    "message": "Tasks retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name_task": "Excavator Swing Bearing Greasing",
                "description": "Apply heavy duty grease to excavator swing bearing and slewing ring",
                "lube_point": 8,
                "stroke_point": 5,
                "machine_id": 1,
                "frequency_id": 2,
                "lubricant_id": 1,
                "created_at": "2025-11-12T10:00:00Z",
                "updated_at": "2025-11-12T10:00:00Z",
                "machine": {
                    "id": 1,
                    "hac": "EX001",
                    "part_machine": "Excavator Bucket",
                    "area": {
                        "id": 1,
                        "name_area": "Mining Area 1",
                        "location": "North Section"
                    }
                },
                "lubricant": {
                    "id": 1,
                    "name_lubricant": "Shell Tellus S4 VX 46",
                    "lubricant_type": "Heavy Duty Hydraulic Oil"
                },
                "frequency": {
                    "id": 2,
                    "frequency_type": "weekly"
                }
            }
        ],
        "per_page": 10,
        "total": 14
    }
}

POST /api/tasks Auth Required

Description: Create a new task

Request Body:

{
    "name_task": "New Lubrication Task",
    "description": "Regular lubrication maintenance for new equipment",
    "lube_point": 6,
    "stroke_point": 4,
    "machine_id": 1,
    "frequency_id": 2,
    "lubricant_id": 1
}

Response:

{
    "success": true,
    "message": "Task created successfully",
    "data": {
        "id": 15,
        "name_task": "New Lubrication Task",
        "description": "Regular lubrication maintenance for new equipment",
        "lube_point": 6,
        "stroke_point": 4,
        "machine_id": 1,
        "frequency_id": 2,
        "lubricant_id": 1,
        "created_at": "2025-11-12T17:45:00Z",
        "updated_at": "2025-11-12T17:45:00Z",
        "machine": {
            "id": 1,
            "hac": "EX001",
            "part_machine": "Excavator Bucket",
            "area": {
                "name_area": "Mining Area 1"
            }
        },
        "lubricant": {
            "id": 1,
            "name_lubricant": "Shell Tellus S4 VX 46"
        },
        "frequency": {
            "id": 2,
            "frequency_type": "weekly"
        }
    }
}

GET /api/tasks/{id} Auth Required

Description: Get specific task by ID

Response:

{
    "success": true,
    "message": "Task retrieved successfully",
    "data": {
        "id": 1,
        "name_task": "Excavator Swing Bearing Greasing",
        "description": "Apply heavy duty grease to excavator swing bearing and slewing ring",
        "lube_point": 8,
        "stroke_point": 5,
        "machine": {
            "hac": "EX001",
            "part_machine": "Excavator Bucket",
            "area": {
                "name_area": "Mining Area 1"
            }
        },
        "lubricant": {
            "name_lubricant": "Shell Tellus S4 VX 46",
            "lubricant_type": "Heavy Duty Hydraulic Oil"
        },
        "frequency": {
            "frequency_type": "weekly"
        }
    }
}

PUT /api/tasks/{id} Auth Required

Description: Update task

Request Body:

{
    "name_task": "Updated Task Name",
    "description": "Updated task description",
    "lube_point": 10,
    "stroke_point": 6,
    "machine_id": 2,
    "frequency_id": 3,
    "lubricant_id": 2
}

DELETE /api/tasks/{id} Auth Required

Description: Delete task

Response:

{
    "success": true,
    "message": "Task deleted successfully"
}

GET /api/tasks/search/name?name_task=Excavator Auth Required

Description: Search tasks by task name

Response:

{
    "success": true,
    "message": "Tasks search completed",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name_task": "Excavator Swing Bearing Greasing",
                "machine": {
                    "hac": "EX001",
                    "part_machine": "Excavator Bucket"
                }
            }
        ]
    }
}

GET /api/tasks/by-machine?machine_id=1 Auth Required

Description: Get tasks by machine ID

GET /api/tasks/by-lubricant?lubricant_id=1 Auth Required

Description: Get tasks by lubricant ID

GET /api/tasks/statistics Auth Required

Description: Get task statistics

Response:

{
    "success": true,
    "message": "Task statistics retrieved successfully",
    "data": {
        "total_tasks": 14,
        "tasks_by_machine": [
            {
                "machine_id": 1,
                "total": 2,
                "machine": {
                    "id": 1,
                    "hac": "EX001",
                    "part_machine": "Excavator Bucket"
                }
            }
        ],
        "tasks_by_lubricant": [
            {
                "lubricant_id": 1,
                "total": 3,
                "lubricant": {
                    "id": 1,
                    "name_lubricant": "Shell Tellus S4 VX 46",
                    "lubricant_type": "Heavy Duty Hydraulic Oil"
                }
            }
        ]
    }
}

GET /api/tasks/pending?frequency_type=weekly&per_page=10 Auth Required

Description: Get pending tasks based on frequency (weekly, monthly, yearly) with Indonesia timezone

Query Parameters:

  • frequency_type (optional): Filter by frequency type (weekly, monthly, yearly)
  • per_page (optional): Number of items per page (default: 10)
  • page (optional): Page number

Response:

{
    "success": true,
    "message": "Pending tasks retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "employee_task_id": 10,
                "user": {
                    "id": 12,
                    "name": "david",
                    "email": "d@d.com"
                },
                "task": {
                    "id": 13,
                    "name_task": "Drill Head Rotation Bearing Greasing",
                    "description": "Apply heavy duty grease to drill head rotation bearings",
                    "lube_point": 10,
                    "stroke_point": 7,
                    "machine": {
                        "id": 8,
                        "hac": "DR008",
                        "part_machine": "Drill Head Assembly",
                        "area": {
                            "id": 2,
                            "name_area": "Mining Area 2",
                            "location": "South Section"
                        }
                    },
                    "lubricant": {
                        "id": 5,
                        "name_lubricant": "Shell Rimula R6 M 10W-40",
                        "lubricant_type": "Heavy Duty Engine Oil"
                    },
                    "frequency": {
                        "id": 3,
                        "frequency_type": "yearly"
                    }
                },
                "frequency_type": "yearly",
                "status": "pending",
                "next_due_date": "2025-12-31 23:59:59",
                "last_report": null,
                "days_overdue": 0
            }
        ],
        "per_page": 10,
        "total": 2
    },
    "timezone": "Asia/Jakarta",
    "current_time": "2025-11-14 21:43:36 WIB"
}

โ„น๏ธ How it works:

  • Weekly tasks: Checks if task was completed this week (Monday to Sunday)
  • Monthly tasks: Checks if task was completed this month
  • Yearly tasks: Checks if task was completed this year
  • Timezone: Uses Indonesia timezone (Asia/Jakarta) for accurate date calculations
  • User Information: Shows which employee is assigned to each pending task
  • Days Overdue: Shows how many days the task is overdue (0 if not overdue yet)

GET /api/tasks/pending/summary Auth Required

Description: Get summary of pending tasks by frequency type

Response:

{
    "success": true,
    "message": "Pending tasks summary retrieved successfully",
    "data": {
        "weekly": {
            "total": 0,
            "pending": 0,
            "completed": 0
        },
        "monthly": {
            "total": 4,
            "pending": 1,
            "completed": 3
        },
        "yearly": {
            "total": 2,
            "pending": 1,
            "completed": 1
        }
    },
    "timezone": "Asia/Jakarta",
    "current_time": "2025-11-14 21:43:43 WIB"
}

โ„น๏ธ Summary Explanation:

  • total: Total number of tasks with this frequency
  • pending: Number of tasks that haven't been completed in the current period
  • completed: Number of tasks that have been completed in the current period

๐Ÿ‘ฅ Employee Task Assignments

GET /api/employee-task/test Public

Description: Test employee task API

Response:

{
    "success": true,
    "message": "Employee Task API is working perfectly!",
    "timestamp": "2025-11-13T10:30:47.377323Z",
    "endpoints": {
        "GET /api/employee-tasks": "Get all employee task assignments with pagination",
        "POST /api/employee-tasks": "Create new employee task assignment",
        "GET /api/employee-tasks/{id}": "Get specific employee task assignment",
        "PUT /api/employee-tasks/{id}": "Update employee task assignment",
        "DELETE /api/employee-tasks/{id}": "Delete employee task assignment",
        "GET /api/employee-tasks/by-employee": "Get tasks by employee",
        "GET /api/employee-tasks/by-task": "Get employees by task",
        "POST /api/employee-tasks/assign-multiple": "Assign multiple employees to a task",
        "GET /api/employee-tasks/statistics": "Get employee task statistics"
    }
}

GET /api/employee-tasks?per_page=10 Auth Required

Description: Get all employee task assignments with pagination

Response:

{
    "success": true,
    "message": "Employee tasks retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "user_id": 2,
                "task_id": 1,
                "created_at": "2025-11-13T10:30:47.000000Z",
                "updated_at": "2025-11-13T10:30:47.000000Z",
                "user": {
                    "id": 2,
                    "name": "Ahmad Subagyo",
                    "email": "ahmad.subagyo@mining.co.id",
                    "email_verified_at": null,
                    "created_at": "2025-11-12T17:42:47.000000Z",
                    "updated_at": "2025-11-12T17:42:47.000000Z"
                },
                "task": {
                    "id": 1,
                    "name_task": "Excavator Swing Bearing Greasing",
                    "description": "Apply grease to swing bearing points on excavator unit",
                    "lube_point": 8,
                    "stroke_point": 12,
                    "machine_id": 1,
                    "frequency_id": 1,
                    "lubricant_id": 1,
                    "created_at": "2025-11-12T17:42:47.000000Z",
                    "updated_at": "2025-11-12T17:42:47.000000Z",
                    "machine": {
                        "id": 1,
                        "hac": "EXC001",
                        "part_machine": "Swing Bearing",
                        "area_id": 1,
                        "description": "Primary excavator swing bearing assembly",
                        "created_at": "2025-11-12T17:42:47.000000Z",
                        "updated_at": "2025-11-12T17:42:47.000000Z",
                        "area": {
                            "id": 1,
                            "name_area": "Loading Point Alpha",
                            "route": "LP-A001",
                            "location": "North Pit"
                        }
                    },
                    "lubricant": {
                        "id": 1,
                        "name_lubricant": "Mobilgrease XHP 222",
                        "lubricant_type": "Heavy Duty Grease"
                    },
                    "frequency": {
                        "id": 1,
                        "name_frequency": "Daily",
                        "duration_hours": 24
                    }
                }
            }
        ],
        "first_page_url": "http://localhost/api/employee-tasks?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "http://localhost/api/employee-tasks?page=1",
        "links": [...],
        "next_page_url": null,
        "path": "http://localhost/api/employee-tasks",
        "per_page": 10,
        "prev_page_url": null,
        "to": 5,
        "total": 5
    }
}

POST /api/employee-tasks Auth Required

Description: Assign an employee to a task

Request Body:

{
    "user_id": 2,
    "task_id": 1
}

Response:

{
    "success": true,
    "message": "Employee task assigned successfully",
    "data": {
        "user_id": 2,
        "task_id": 1,
        "updated_at": "2025-11-13T10:30:47.000000Z",
        "created_at": "2025-11-13T10:30:47.000000Z",
        "id": 6,
        "user": {
            "id": 2,
            "name": "Ahmad Subagyo",
            "email": "ahmad.subagyo@mining.co.id"
        },
        "task": {
            "id": 1,
            "name_task": "Excavator Swing Bearing Greasing",
            "description": "Apply grease to swing bearing points on excavator unit",
            "machine": {
                "id": 1,
                "hac": "EXC001",
                "part_machine": "Swing Bearing",
                "area": {
                    "id": 1,
                    "name_area": "Loading Point Alpha",
                    "route": "LP-A001",
                    "location": "North Pit"
                }
            },
            "lubricant": {
                "id": 1,
                "name_lubricant": "Mobilgrease XHP 222",
                "lubricant_type": "Heavy Duty Grease"
            }
        }
    }
}

POST /api/employee-tasks/assign-multiple Auth Required

Description: Assign multiple employees to a single task

Request Body:

{
    "task_id": 1,
    "user_ids": [2, 3, 4]
}

Response:

{
    "success": true,
    "message": "Multiple employee assignments completed",
    "data": {
        "assignments_created": [
            {
                "id": 7,
                "user_id": 2,
                "task_id": 1,
                "created_at": "2025-11-13T10:30:47.000000Z",
                "user": {
                    "id": 2,
                    "name": "Ahmad Subagyo",
                    "email": "ahmad.subagyo@mining.co.id"
                },
                "task": {
                    "id": 1,
                    "name_task": "Excavator Swing Bearing Greasing"
                }
            }
        ],
        "assignments_skipped": [3],
        "total_created": 2,
        "total_skipped": 1
    }
}

GET /api/employee-tasks/{id} Auth Required

Description: Get specific employee task assignment

Response:

{
    "success": true,
    "message": "Employee task retrieved successfully",
    "data": {
        "id": 1,
        "user_id": 2,
        "task_id": 1,
        "created_at": "2025-11-13T10:30:47.000000Z",
        "updated_at": "2025-11-13T10:30:47.000000Z",
        "user": {
            "id": 2,
            "name": "Ahmad Subagyo",
            "email": "ahmad.subagyo@mining.co.id"
        },
        "task": {
            "id": 1,
            "name_task": "Excavator Swing Bearing Greasing",
            "description": "Apply grease to swing bearing points on excavator unit",
            "machine": {
                "hac": "EXC001",
                "part_machine": "Swing Bearing",
                "area": {
                    "name_area": "Loading Point Alpha",
                    "location": "North Pit"
                }
            }
        }
    }
}

PUT /api/employee-tasks/{id} Auth Required

Description: Update employee task assignment

Request Body:

{
    "user_id": 3,
    "task_id": 2
}

Response:

{
    "success": true,
    "message": "Employee task updated successfully",
    "data": {
        "id": 1,
        "user_id": 3,
        "task_id": 2,
        "created_at": "2025-11-13T10:30:47.000000Z",
        "updated_at": "2025-11-13T10:35:22.000000Z"
    }
}

DELETE /api/employee-tasks/{id} Auth Required

Description: Remove employee task assignment

Response:

{
    "success": true,
    "message": "Employee task assignment deleted successfully"
}

GET /api/employee-tasks/by-employee?user_id=2&per_page=10 Auth Required

Description: Get all tasks assigned to a specific employee

Response:

{
    "success": true,
    "message": "Employee tasks retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "user_id": 2,
                "task_id": 1,
                "user": {
                    "id": 2,
                    "name": "Ahmad Subagyo",
                    "email": "ahmad.subagyo@mining.co.id"
                },
                "task": {
                    "id": 1,
                    "name_task": "Excavator Swing Bearing Greasing",
                    "machine": {
                        "hac": "EXC001",
                        "part_machine": "Swing Bearing"
                    },
                    "lubricant": {
                        "name_lubricant": "Mobilgrease XHP 222"
                    }
                }
            }
        ],
        "total": 3
    }
}

GET /api/employee-tasks/by-task?task_id=1&per_page=10 Auth Required

Description: Get all employees assigned to a specific task

Response:

{
    "success": true,
    "message": "Task assignments retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "user_id": 2,
                "task_id": 1,
                "user": {
                    "id": 2,
                    "name": "Ahmad Subagyo",
                    "email": "ahmad.subagyo@mining.co.id"
                },
                "task": {
                    "id": 1,
                    "name_task": "Excavator Swing Bearing Greasing"
                }
            },
            {
                "id": 2,
                "user_id": 3,
                "task_id": 1,
                "user": {
                    "id": 3,
                    "name": "Budi Santoso",
                    "email": "budi.santoso@mining.co.id"
                },
                "task": {
                    "id": 1,
                    "name_task": "Excavator Swing Bearing Greasing"
                }
            }
        ],
        "total": 2
    }
}

GET /api/employee-tasks/statistics Auth Required

Description: Get employee task assignment statistics

Response:

{
    "success": true,
    "message": "Employee task statistics retrieved successfully",
    "data": {
        "total_assignments": 15,
        "unique_employees": 8,
        "unique_tasks": 12,
        "assignments_by_employee": [
            {
                "user_id": 2,
                "total": 5,
                "user": {
                    "id": 2,
                    "name": "Ahmad Subagyo",
                    "email": "ahmad.subagyo@mining.co.id"
                }
            },
            {
                "user_id": 3,
                "total": 4,
                "user": {
                    "id": 3,
                    "name": "Budi Santoso",
                    "email": "budi.santoso@mining.co.id"
                }
            }
        ],
        "assignments_by_task": [
            {
                "task_id": 1,
                "total": 3,
                "task": {
                    "id": 1,
                    "name_task": "Excavator Swing Bearing Greasing",
                    "machine_id": 1
                }
            },
            {
                "task_id": 2,
                "total": 2,
                "task": {
                    "id": 2,
                    "name_task": "Bulldozer Track Maintenance",
                    "machine_id": 2
                }
            }
        ]
    }
}

๐Ÿ“‹ Employee Task Features:

  • โœ… Assignment Management: Assign employees to specific tasks
  • โœ… Multiple Assignment: Assign multiple employees to one task at once
  • โœ… Duplicate Prevention: Prevents duplicate assignments automatically
  • โœ… Employee Tasks: View all tasks assigned to a specific employee
  • โœ… Task Employees: View all employees assigned to a specific task
  • โœ… Full CRUD Operations: Create, read, update, delete assignments
  • โœ… Statistics & Analytics: Track assignment patterns and workload distribution
  • โœ… Relationship Loading: Includes full user and task details with machine/area info

โš ๏ธ Important Notes:

  • Duplicate Check: System prevents assigning the same employee to the same task twice
  • Cascade Delete: Assignments are automatically deleted when user or task is deleted
  • Validation: Both user_id and task_id must exist in their respective tables
  • Authentication: All endpoints except test endpoint require Bearer token authentication

๐Ÿ“ธ Inspection Reports

GET /api/inspection-report/test Public

Description: Test inspection report API

Response:

{
    "success": true,
    "message": "Inspection Report API is working perfectly!",
    "timestamp": "2025-11-13T11:30:47.377323Z",
    "upload_path": "/uploads/inspection_reports/",
    "endpoints": {
        "GET /api/inspection-reports": "Get all inspection reports with pagination",
        "POST /api/inspection-reports": "Create new inspection report (with photo upload)",
        "GET /api/inspection-reports/{id}": "Get specific inspection report",
        "PUT /api/inspection-reports/{id}": "Update inspection report",
        "DELETE /api/inspection-reports/{id}": "Delete inspection report",
        "GET /api/inspection-reports/by-employee-task": "Get reports by employee task",
        "GET /api/inspection-reports/by-employee": "Get reports by employee",
        "GET /api/inspection-reports/by-task": "Get reports by task",
        "GET /api/inspection-reports/search/remarks": "Search by remarks",
        "GET /api/inspection-reports/statistics": "Get inspection report statistics"
    }
}

GET /api/inspection-reports?per_page=10 Auth Required

Description: Get all inspection reports with pagination

Response:

{
    "success": true,
    "message": "Inspection reports retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "employee_task_id": 1,
                "remarks": "Excavator swing bearing checked, lubrication applied successfully. All points covered.",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496247_abc123def.jpg",
                "created_at": "2025-11-13T11:30:47.000000Z",
                "updated_at": "2025-11-13T11:30:47.000000Z",
                "employee_task": {
                    "id": 1,
                    "user_id": 2,
                    "task_id": 1,
                    "created_at": "2025-11-13T10:30:47.000000Z",
                    "updated_at": "2025-11-13T10:30:47.000000Z",
                    "user": {
                        "id": 2,
                        "name": "Ahmad Subagyo",
                        "email": "ahmad.subagyo@mining.co.id"
                    },
                    "task": {
                        "id": 1,
                        "name_task": "Excavator Swing Bearing Greasing",
                        "description": "Apply grease to swing bearing points on excavator unit",
                        "lube_point": 8,
                        "stroke_point": 12,
                        "machine": {
                            "id": 1,
                            "hac": "EXC001",
                            "part_machine": "Swing Bearing",
                            "area": {
                                "id": 1,
                                "name_area": "Loading Point Alpha",
                                "location": "North Pit"
                            }
                        },
                        "lubricant": {
                            "id": 1,
                            "name_lubricant": "Mobilgrease XHP 222",
                            "lubricant_type": "Heavy Duty Grease"
                        },
                        "frequency": {
                            "id": 1,
                            "name_frequency": "Daily",
                            "duration_hours": 24
                        }
                    }
                }
            }
        ],
        "first_page_url": "http://localhost/api/inspection-reports?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "http://localhost/api/inspection-reports?page=1",
        "links": [...],
        "next_page_url": null,
        "path": "http://localhost/api/inspection-reports",
        "per_page": 10,
        "prev_page_url": null,
        "to": 3,
        "total": 3
    }
}

POST /api/inspection-reports Auth Required

Description: Create new inspection report with photo upload

Request (Form Data):

Content-Type: multipart/form-data

employee_task_id: 1
remarks: "Hydraulic system checked successfully. All pressure points within normal range. Minor leak detected on connection point 3, will monitor."
photo: [FILE] (JPEG/PNG/JPG/GIF, max 5MB)

Response:

{
    "success": true,
    "message": "Inspection report created successfully",
    "data": {
        "employee_task_id": 1,
        "remarks": "Hydraulic system checked successfully. All pressure points within normal range.",
        "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496847_xyz789abc.jpg",
        "updated_at": "2025-11-13T11:40:47.000000Z",
        "created_at": "2025-11-13T11:40:47.000000Z",
        "id": 4,
        "employee_task": {
            "id": 1,
            "user": {
                "id": 2,
                "name": "Ahmad Subagyo",
                "email": "ahmad.subagyo@mining.co.id"
            },
            "task": {
                "id": 1,
                "name_task": "Excavator Swing Bearing Greasing",
                "machine": {
                    "hac": "EXC001",
                    "part_machine": "Swing Bearing"
                }
            }
        }
    }
}

GET /api/inspection-reports/{id} Auth Required

Description: Get specific inspection report with full details

Response:

{
    "success": true,
    "message": "Inspection report retrieved successfully",
    "data": {
        "id": 1,
        "employee_task_id": 1,
        "remarks": "Task completed successfully. All lubrication points covered.",
        "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496247_abc123def.jpg",
        "created_at": "2025-11-13T11:30:47.000000Z",
        "updated_at": "2025-11-13T11:30:47.000000Z",
        "employee_task": {
            "user": {
                "name": "Ahmad Subagyo",
                "email": "ahmad.subagyo@mining.co.id"
            },
            "task": {
                "name_task": "Excavator Swing Bearing Greasing",
                "machine": {
                    "hac": "EXC001",
                    "area": {
                        "name_area": "Loading Point Alpha"
                    }
                }
            }
        }
    }
}

PUT /api/inspection-reports/{id} Auth Required

Description: Update inspection report (can update photo)

Request (Form Data):

Content-Type: multipart/form-data

remarks: "Updated: Task completed with minor issues. Replacement parts ordered."
photo: [NEW_FILE] (Optional - will replace existing photo)

Response:

{
    "success": true,
    "message": "Inspection report updated successfully",
    "data": {
        "id": 1,
        "employee_task_id": 1,
        "remarks": "Updated: Task completed with minor issues. Replacement parts ordered.",
        "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731497047_new456xyz.jpg",
        "created_at": "2025-11-13T11:30:47.000000Z",
        "updated_at": "2025-11-13T11:43:47.000000Z"
    }
}

DELETE /api/inspection-reports/{id} Auth Required

Description: Delete inspection report (also deletes photo file)

Response:

{
    "success": true,
    "message": "Inspection report deleted successfully"
}

GET /api/inspection-reports/by-employee-task?employee_task_id=1&per_page=10 Auth Required

Description: Get all inspection reports for specific employee task assignment

Response:

{
    "success": true,
    "message": "Inspection reports by employee task retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "employee_task_id": 1,
                "remarks": "First inspection completed",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496247_abc123def.jpg",
                "created_at": "2025-11-13T11:30:47.000000Z"
            },
            {
                "id": 2,
                "employee_task_id": 1,
                "remarks": "Follow-up inspection",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496547_def456ghi.jpg",
                "created_at": "2025-11-13T11:35:47.000000Z"
            }
        ],
        "total": 2
    }
}

GET /api/inspection-reports/by-employee?user_id=2&per_page=10 Auth Required

Description: Get all inspection reports created by specific employee

Response:

{
    "success": true,
    "message": "Inspection reports by employee retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "remarks": "Excavator maintenance completed",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496247_abc123def.jpg",
                "employee_task": {
                    "user": {
                        "id": 2,
                        "name": "Ahmad Subagyo"
                    },
                    "task": {
                        "name_task": "Excavator Swing Bearing Greasing"
                    }
                }
            }
        ],
        "total": 5
    }
}

GET /api/inspection-reports/by-task?task_id=1&per_page=10 Auth Required

Description: Get all inspection reports for specific task

Response:

{
    "success": true,
    "message": "Inspection reports by task retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "remarks": "Task completed by Ahmad",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496247_abc123def.jpg",
                "employee_task": {
                    "user": {
                        "name": "Ahmad Subagyo"
                    },
                    "task": {
                        "id": 1,
                        "name_task": "Excavator Swing Bearing Greasing"
                    }
                }
            },
            {
                "id": 3,
                "remarks": "Task completed by Budi",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731496747_ghi789jkl.jpg",
                "employee_task": {
                    "user": {
                        "name": "Budi Santoso"
                    },
                    "task": {
                        "id": 1,
                        "name_task": "Excavator Swing Bearing Greasing"
                    }
                }
            }
        ],
        "total": 2
    }
}

GET /api/inspection-reports/search/remarks?remarks=hydraulic&per_page=10 Auth Required

Description: Search inspection reports by remarks content

Response:

{
    "success": true,
    "message": "Inspection reports search completed",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 4,
                "remarks": "Hydraulic system pressure checked and adjusted",
                "photo_url": "http://localhost/uploads/inspection_reports/inspection_1731497247_mno123pqr.jpg",
                "employee_task": {
                    "user": {
                        "name": "Ahmad Subagyo"
                    },
                    "task": {
                        "name_task": "Hydraulic System Check"
                    }
                }
            }
        ],
        "total": 1
    }
}

GET /api/inspection-reports/statistics Auth Required

Description: Get comprehensive inspection report statistics

Response:

{
    "success": true,
    "message": "Inspection report statistics retrieved successfully",
    "data": {
        "total_reports": 25,
        "reports_today": 5,
        "reports_this_week": 18,
        "reports_this_month": 25,
        "reports_by_employee": [
            {
                "id": 2,
                "name": "Ahmad Subagyo",
                "email": "ahmad.subagyo@mining.co.id",
                "total": 8
            },
            {
                "id": 3,
                "name": "Budi Santoso",
                "email": "budi.santoso@mining.co.id",
                "total": 7
            },
            {
                "id": 4,
                "name": "Candra Wijaya",
                "email": "candra.wijaya@mining.co.id",
                "total": 5
            }
        ],
        "reports_by_task": [
            {
                "id": 1,
                "name_task": "Excavator Swing Bearing Greasing",
                "total": 6
            },
            {
                "id": 2,
                "name_task": "Bulldozer Track Maintenance",
                "total": 4
            },
            {
                "id": 3,
                "name_task": "Hydraulic System Check",
                "total": 3
            }
        ]
    }
}

๐Ÿ“ธ Inspection Report Features:

  • โœ… Photo Upload: Images stored in public/uploads/inspection_reports/
  • โœ… File Management: Automatic photo deletion when report is deleted
  • โœ… Photo Update: Replace existing photos during updates
  • โœ… Full CRUD: Complete create, read, update, delete operations
  • โœ… Advanced Search: By employee, task, employee-task, or remarks content
  • โœ… Statistics: Comprehensive analytics including time-based reports
  • โœ… Relationship Loading: Full employee, task, machine, and area details
  • โœ… Validation: Image format and size validation (max 5MB)
  • โœ… URL Generation: Automatic full URL generation for photo access

โš ๏ธ Important Notes:

  • File Upload: Use multipart/form-data for requests with photo uploads
  • Photo Storage: Files saved to public/uploads/inspection_reports/ (accessible via URL)
  • File Size: Maximum 5MB per photo upload
  • Supported Formats: JPEG, PNG, JPG, GIF
  • Auto Cleanup: Photos automatically deleted when report is deleted
  • Directory Creation: Upload directory created automatically if doesn't exist
  • Authentication: All endpoints except test require Bearer token authentication
  • Employee Task ID: Must reference existing employee_task record

๐Ÿ›ข๏ธ Lubricants Management

GET /api/lubricant/test Public

Description: Test lubricant API

GET /api/lubricants?per_page=10 Auth Required

Description: Get all lubricants with pagination

POST /api/lubricants Auth Required

Description: Create new lubricant

๐Ÿ“ค Request Body:

{ "name_lubricant": "Mobile DTE 10 Excel 46", "lubricant_type": "Hydraulic Oil" }

๐Ÿ“‹ Required Fields:

Field Type Required Description
name_lubricant string Yes Lubricant name (unique)
lubricant_type string Yes Type of lubricant (e.g., Engine Oil, Hydraulic Oil, Grease)

GET /api/lubricants/{id} Auth Required

Description: Get lubricant by ID

PUT /api/lubricants/{id} Auth Required

Description: Update lubricant

DELETE /api/lubricants/{id} Auth Required

Description: Delete lubricant

GET /api/lubricants/search/name?name_lubricant=Mobile Auth Required

Description: Search lubricants by name

Parameters: name_lubricant (required, min 2 chars), per_page (optional)

GET /api/lubricants/search/type?lubricant_type=Hydraulic Auth Required

Description: Search lubricants by type

Parameters: lubricant_type (required, min 2 chars), per_page (optional)

GET /api/lubricants/by-type Auth Required

Description: Get lubricants grouped by type with counts

GET /api/lubricants/distinct-types Auth Required

Description: Get list of distinct lubricant types

GET /api/lubricants/statistics Auth Required

Description: Get lubricant statistics and breakdown by type

๐Ÿ“ฅ Response Example:

{ "success": true, "message": "Lubricant statistics retrieved successfully", "data": { "total_lubricants": 25, "total_types": 4, "types_breakdown": [ {"lubricant_type": "Hydraulic Oil", "count": 10}, {"lubricant_type": "Engine Oil", "count": 8}, {"lubricant_type": "Grease", "count": 5}, {"lubricant_type": "Gear Oil", "count": 2} ] } }

๐Ÿ“ Usage Examples

๐Ÿ”น Step 1: Login to get token

curl -X POST https://sbilaravel.web.id/api/login \ -H "Content-Type: application/json" \ -d '{ "email": "supervisor@miningcompany.com", "password": "password" }'

๐Ÿ”น Step 2: Use token for protected endpoints

curl -X GET https://sbilaravel.web.id/api/users \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Accept: application/json"

๐Ÿ”น Create new user

curl -X POST https://sbilaravel.web.id/api/users \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "name": "David Operator", "email": "david@miningcompany.com", "password": "password123", "role": "operator" }'

๐Ÿ”น Search users

curl -X GET "https://sbilaravel.web.id/api/users/search/name?name=Ahmad&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Create area

curl -X POST https://sbilaravel.web.id/api/areas \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "name_area": "Mining Pit Area A", "route": "Main Mining Route", "location": "North Sector" }'

๐Ÿ”น Create new machine

curl -X POST https://sbilaravel.web.id/api/machines \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "hac": "EX002", "part_machine": "Excavator Engine", "area_id": 1, "description": "Heavy duty excavator engine for mining operations" }'

๐Ÿ”น Search machines by HAC

curl -X GET "https://sbilaravel.web.id/api/machines/search/hac?hac=EX&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get machines by area

curl -X GET "https://sbilaravel.web.id/api/machines/by-area?area_id=1&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Create new task

curl -X POST https://sbilaravel.web.id/api/tasks \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "name_task": "Daily Engine Check", "description": "Regular daily engine inspection and lubrication", "lube_point": 4, "stroke_point": 2, "machine_id": 1, "frequency_id": 1, "lubricant_id": 1 }'

๐Ÿ”น Search tasks by name

curl -X GET "https://sbilaravel.web.id/api/tasks/search/name?name_task=Excavator&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get tasks by machine

curl -X GET "https://sbilaravel.web.id/api/tasks/by-machine?machine_id=1&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Create new lubricant

curl -X POST https://sbilaravel.web.id/api/lubricants \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "name_lubricant": "Mobile DTE 10 Excel 46", "lubricant_type": "Hydraulic Oil" }'

๐Ÿ”น Search lubricants by type

curl -X GET "https://sbilaravel.web.id/api/lubricants/search/type?lubricant_type=Hydraulic&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get lubricant statistics

curl -X GET https://sbilaravel.web.id/api/lubricants/statistics \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Search areas by location

curl -X GET "https://sbilaravel.web.id/api/areas/search/location?location=North&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get area statistics

curl -X GET https://sbilaravel.web.id/api/areas/statistics \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Assign employee to task

curl -X POST https://sbilaravel.web.id/api/employee-tasks \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "user_id": 2, "task_id": 1 }'

๐Ÿ”น Assign multiple employees to one task

curl -X POST https://sbilaravel.web.id/api/employee-tasks/assign-multiple \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "task_id": 1, "user_ids": [2, 3, 4, 5] }'

๐Ÿ”น Get tasks assigned to employee

curl -X GET "https://sbilaravel.web.id/api/employee-tasks/by-employee?user_id=2&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get employees assigned to task

curl -X GET "https://sbilaravel.web.id/api/employee-tasks/by-task?task_id=1&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get employee task statistics

curl -X GET https://sbilaravel.web.id/api/employee-tasks/statistics \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Create inspection report with photo

curl -X POST https://sbilaravel.web.id/api/inspection-reports \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -F "employee_task_id=1" \ -F "remarks=Hydraulic system checked. All pressure points normal. Minor leak on connection 3." \ -F "photo=@/path/to/inspection_photo.jpg"

๐Ÿ”น Get inspection reports by employee

curl -X GET "https://sbilaravel.web.id/api/inspection-reports/by-employee?user_id=2&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Search inspection reports by remarks

curl -X GET "https://sbilaravel.web.id/api/inspection-reports/search/remarks?remarks=hydraulic&per_page=5" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Get inspection report statistics

curl -X GET https://sbilaravel.web.id/api/inspection-reports/statistics \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Enhanced Task Creation with Employee Assignment

When creating a task, you can also assign employees automatically:

Step 1: Create the task
curl -X POST https://sbilaravel.web.id/api/tasks \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "name_task": "Weekly Hydraulic System Check", "description": "Comprehensive hydraulic system inspection and lubrication", "lube_point": 6, "stroke_point": 4, "machine_id": 2, "frequency_id": 2, "lubricant_id": 3 }'
Step 2: Assign employees to the created task (Task ID from step 1)
curl -X POST https://sbilaravel.web.id/api/employee-tasks/assign-multiple \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "task_id": 6, "user_ids": [2, 3, 4] }'
Step 3: Verify employee assignments
curl -X GET "https://sbilaravel.web.id/api/employee-tasks/by-task?task_id=6" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿ”น Complete Employee Task Management Workflow

๐Ÿ“‹ Scenario: Assigning maintenance tasks to mining crew
1. Get available employees
curl -X GET "https://sbilaravel.web.id/api/users?role=operator" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
2. Get tasks that need assignment
curl -X GET "https://sbilaravel.web.id/api/tasks" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
3. Assign multiple employees to critical tasks
curl -X POST https://sbilaravel.web.id/api/employee-tasks/assign-multiple \ -H "Authorization: Bearer YOUR_TOKEN_HERE" \ -H "Content-Type: application/json" \ -d '{ "task_id": 1, "user_ids": [2, 3, 5, 7] }'
4. Check employee workload distribution
curl -X GET https://sbilaravel.web.id/api/employee-tasks/statistics \ -H "Authorization: Bearer YOUR_TOKEN_HERE"
5. Get specific employee's task list
curl -X GET "https://sbilaravel.web.id/api/employee-tasks/by-employee?user_id=2" \ -H "Authorization: Bearer YOUR_TOKEN_HERE"

๐Ÿงช Testing

๐Ÿ“š Response Codes

  • 200 OK: Request successful
  • 201 Created: Resource created
  • 401 Unauthorized: Invalid/missing token
  • 404 Not Found: Resource not found
  • 422 Validation Error: Invalid input
  • 500 Server Error: Internal error

๐Ÿ“Ž Important Notes

  • All requests/responses are in JSON format
  • Include Content-Type: application/json for POST/PUT
  • Token expires - handle 401 by re-authenticating
  • Use pagination for large datasets
  • Search requires minimum 2 characters (departments)