Skip to main content

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

  1. Token Validation: Every request must include a Bearer JWT.
  2. Context Extraction: The API extracts skole_id and user_role from the token.
  3. Data Scoping:
    • Parents can only access records for their linked children (student_id check).
    • Teachers can only access records for assigned grades/students.
    • Admins have full read/write access within their skole_id.

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.mark perms 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_status indicates 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.