1. API Purpose
The Attendance API allows parents to monitor their child’s daily presence and enables teachers/admins to record and update attendance records. It ensures transparency and accurate record-keeping for the school.2. Endpoint Definition
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /parent-app/attendance | 🔐 JWT | View student attendance history |
| GET | /teachers-app/attendance | 🔐 JWT | View class/student attendance |
| POST | /teachers-app/attendance | 🔐 JWT | Record student attendance |
| PUT | /teachers-app/attendance/:id | 🔐 JWT | Update specific attendance record |
| GET | /web-app/view-attendance | 🔐 JWT | Admin: attendance reports |
3. Authentication Flow
- Token Validation: Every request must include a Bearer JWT.
- Context Extraction: The API extracts
skole_idanduser_rolefrom the token. - Data Scoping:
- Parents can only access records for their linked children (
student_idcheck). - Teachers can only access records for assigned grades/students.
- Admins have full read/write access within their
skole_id.
- Parents can only access records for their linked children (
4. Request Structure
GET /parent-app/attendance
Query Parameters:| Field | Type | Required | Description |
|---|---|---|---|
| roll_no | string | Yes | Unique student identifier. |
GET /teachers-app/attendance
Query Parameters:| Field | Type | Required | Description |
|---|---|---|---|
| skole_id | string | Yes | School identifier. |
| student_id | number | No | Filter by specific student. |
| date | string | No | Filter by date (YYYY-MM-DD). |
| grade | string | No | Filter by grade/class. |
POST /teachers-app/attendance
Request Body:PUT /teachers-app/attendance/:id
URL Parameters:| Field | Type | Description |
|---|---|---|
| id | number | Unique ID of the attendance record. |
GET /web-app/view-attendance
Query Parameters:| Field | Type | Required | Description |
|---|---|---|---|
| skole_id | string | Yes | School identifier. |
| start_date | string | No | Filter from (YYYY-MM-DD). |
| end_date | string | No | Filter to (YYYY-MM-DD). |
| grade | string | No | Filter by grade/class. |
5. Response Structure
Success: Student Attendance History (200 OK)
Route:GET /parent-app/attendance
Success: Class Attendance View (200 OK)
Route:GET /teachers-app/attendance
Success: Attendance Recorded (201 Created)
Route:POST /teachers-app/attendance
Success: Attendance Updated (200 OK)
Route:PUT /teachers-app/attendance/:id
Success: Attendance Report (200 OK)
Route:GET /web-app/view-attendance
6. Error Responses
| HTTP Code | Error Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS | Missing roll_no or invalid date format |
| 404 | NOT_FOUND | Student not found or no records for date |
7. Security Considerations
- Scoping: Data isolation is enforced via
skole_id. - Role-Based Access: Standard staff can view; only staff with
attendance.markperms can record.
8. Token Usage
9. Token Refresh
Attendance endpoints do not trigger token refresh. Standard JWT rotation at the auth layer applies.10. Logout / Session Invalidation
Not directly handled in this module.11. Usage Example (cURL)
12. Notes / Special Behaviors
- Availability:
availability_statusindicates if the student is currently on premises. - Bulk Imports: The Web Admin app supports bulk attendance imports via CSV/Excel through a dedicated multipart endpoint.