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
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:
Headers:
GET /teachers-app/attendance
Query Parameters:POST /teachers-app/attendance
Request Body:PUT /teachers-app/attendance/:id
URL Parameters:
Request Body:
GET /web-app/view-attendance
Query Parameters: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
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.