1. API Purpose
The Write To module provides a structured ticketing system for parent-to-school communication. It replaces informal calls/notes with trackable threads for leave requests, complaints, and queries.2. Endpoint Definition
3. Authentication Flow
Standard JWT validation.- Parents can only see requests they created (
parent_idmatch). - Staff can see all requests for their school (
skole_idmatch).
4. Request Structure
POST /parent-app/write-to
Request Body:GET /parent-app/write-to
Query Parameters:GET /parent-app/write-to/:id
URL Parameters:POST /parent-app/write-to/:id/reply
Request Body:GET /teachers-app/write-to
Query Parameters:POST /teachers-app/write-to/:id/reply
Request Body:PUT /teachers-app/write-to/:id
Request Body:5. Response Structure
Success: Request Submitted (201 Created)
Route:POST /parent-app/write-to
Success: Parent Request List (200 OK)
Route:GET /parent-app/write-to
Success: Full Thread View (200 OK)
Route:GET /parent-app/write-to/:id
Success: Staff Request Queue (200 OK)
Route:GET /teachers-app/write-to
Success: Reply Posted (201 Created)
Route:POST /{module}/write-to/:id/reply
Success: Ticket Resolved (200 OK)
Route:PUT /teachers-app/write-to/:id
6. Error Responses
7. Security Considerations
- Thread Integrity: Replies are linked via
write_to_id. - Role Scoping: Only staff with specific permissions can resolve tickets or assign them to others.
8. Token Usage
9. Token Refresh
N/A.10. Logout / Session Invalidation
N/A.11. Usage Example (cURL)
12. Notes / Special Behaviors
- Leave Logic: Submitting a
leavetype request automatically notifies the class teacher via push notification. - Auto-Close: Inactive resolved threads are archived after a defined period (e.g., 30 days).