1. API Purpose
The Activities API serves as the school’s social feed. It communicates events, achievements, and general announcements to parents, fostering engagement through a familiar interactive interface.2. Endpoint Definition
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /parent-app/activities | 🔐 JWT | View paginated activity feed |
| GET | /teachers-app/activities | 🔐 JWT | List school-wide activities |
| POST | /teachers-app/activities | 🔐 JWT | Post a new activity or announcement |
| PUT | /teachers-app/activities/:id | 🔐 JWT | Edit existing activity details |
| DELETE | /teachers-app/activities/:id | 🔐 JWT | Soft-delete an activity |
| GET | /web-app/activities | 🔐 JWT | Admin: Comprehensive activity list |
3. Authentication Flow
Standard Bearer JWT validation. Access is scoped byskole_id. Staff require specific RBAC permissions to create or delete posts.
4. Request Structure
GET /parent-app/activities
Query Parameters:| Field | Type | Required | Description |
|---|---|---|---|
| activity_type | string | No | Filter by type (event/announcement). |
| student_id | string | No | Filter by specific student. |
GET /teachers-app/activities
Query Parameters:| Field | Type | Required | Description |
|---|---|---|---|
| skole_id | string | Yes | School identifier. |
| activity_type | string | No | Filter by type. |
| status | string | No | Filter by status (draft/published). |
POST /teachers-app/activities
Request Body:PUT /teachers-app/activities/:id
Request Body:DELETE /teachers-app/activities/:id
URL Parameters:| Field | Type | Description |
|---|---|---|
| id | number | ID of the activity to delete. |
GET /web-app/activities
Query Parameters:| Field | Type | Required | Description |
|---|---|---|---|
| skole_id | string | Yes | School identifier. |
| page | number | No | Page number (Default: 1). |
| limit | number | No | Records per page (Default: 10). |
5. Response Structure
Success: Parent Feed View (200 OK)
Route:GET /parent-app/activities
Success: Teacher Activity List (200 OK)
Route:GET /teachers-app/activities
Success: Activity Created (201 Created)
Route:POST /teachers-app/activities
Success: Activity Updated (200 OK)
Route:PUT /teachers-app/activities/:id
Success: Activity Deleted (200 OK)
Route:DELETE /teachers-app/activities/:id
Success: Admin Dashboard Feed (200 OK)
Route:GET /web-app/activities
6. Error Responses
| HTTP Code | Description |
|---|---|
| 400 | Invalid skole_id or missing title |
| 404 | Activity not found |
7. Security Considerations
- Soft Delete:
deleted_status = 1hides the item from all feeds without breaking database relations. - Tenant Isolation: Enforced via
skole_idin JWT payload.
8. Token Usage
9. Token Refresh
N/A.10. Logout / Session Invalidation
N/A.11. Usage Example (cURL)
12. Notes / Special Behaviors
- Engagement Integration: Comments and reactions for activities are handled by the separate Engagement API.
- Targeting: Activities can be “School-wide” or targeted to a specific
student_id.