Skip to main content

1. API Purpose

The Noticeboard API serves as the school’s official broadcast channel. It provides a permanent and searchable record of formal announcements, replacing physical notice boards.

2. Endpoint Definition

MethodRouteAuthDescription
GET/parent-app/noticeboard🔐 JWTView official school notices
GET/teachers-app/noticeboard🔐 JWTView official school notices
GET/web-app/noticeboard🔐 JWTAdmin: View school-wide notices
POST/web-app/noticeboard🔐 JWTAdmin: Create a new formal notice
PUT/web-app/noticeboard/:id🔐 JWTAdmin: Update notice content
DELETE/web-app/noticeboard/:id🔐 JWTAdmin: Soft-delete a notice

3. Authentication Flow

Standard JWT validation. All parents and staff within the same school (skole_id) see the same global noticeboard feed.

4. Request Structure

GET /parent-app/noticeboard

Headers:
Authorization: Bearer <TOKEN>

GET /teachers-app/noticeboard

Query Parameters:
FieldTypeRequiredDescription
skole_idstringYesSchool identifier.
notice_typestringNoFilter by type.

GET /web-app/noticeboard

Query Parameters:
FieldTypeRequiredDescription
skole_idstringYesSchool identifier.
pagenumberNoPage number (Default: 1).
limitnumberNoRecords per page (Default: 10).

POST /web-app/noticeboard

Request Body:
{
  "skole_id": "SKL001",
  "notice_title": "Summer Vacation Schedule",
  "notice_desc": "The school will remain closed from April 1st to April 15th.",
  "notice_type": "holiday"
}

PUT /web-app/noticeboard/:id

Request Body:
{
  "notice_title": "Updated holiday Schedule",
  "notice_desc": "..."
}

DELETE /web-app/noticeboard/:id

URL Parameters:
FieldTypeDescription
idnumberID of the notice to delete.

5. Response Structure

Success: Parent Notice Feed (200 OK)

Route: GET /parent-app/noticeboard
{
  "success": true,
  "data": [
    {
      "id": 12,
      "notice_title": "Sports Day Schedule",
      "notice_type": "event",
      "created_at": "2024-03-01T10:00:00Z"
    }
  ]
}

Success: Teacher Notice Feed (200 OK)

Route: GET /teachers-app/noticeboard
{
  "success": true,
  "data": [
    {
      "id": 12,
      "notice_title": "Staff Meeting",
      "notice_type": "meeting",
      "skole_id": "SKL001"
    }
  ]
}

Success: Admin Notice List (200 OK)

Route: GET /web-app/noticeboard
{
  "success": true,
  "data": {
    "notices": [...],
    "count": 50
  }
}

Success: Notice Created (201 Created)

Route: POST /web-app/noticeboard
{
  "success": true,
  "message": "Notice published",
  "data": { "id": 13 }
}

Success: Notice Updated (200 OK)

Route: PUT /web-app/noticeboard/:id
{
  "success": true,
  "message": "Notice content updated"
}

Success: Notice Deleted (200 OK)

Route: DELETE /web-app/noticeboard/:id
{
  "success": true,
  "message": "Notice archived"
}

6. Error Responses

HTTP CodeDescription
404Notice not found
400Missing notice_title in creation

7. Security Considerations

  • Integrity: Only users with noticeboard.create staff permissions can broadcast notices.
  • Soft Delete: notice_deleted = 1 removes the notice from public view while preserving audit logs.

8. Token Usage

GET /parent-app/noticeboard
Authorization: Bearer <TOKEN>

9. Token Refresh

N/A.

10. Logout / Session Invalidation

N/A.

11. Usage Example (cURL)

curl -H "Authorization: Bearer <TOKEN>" \
"http://localhost:3000/parent-app/noticeboard?notice_type=exam"

12. Notes / Special Behaviors

  • Typing: Notice types determine the color-coding in the mobile app (e.g., Blue for exam, Orange for fee).
  • Persistence: Unlike Activities, notices are generally long-lived and pinned to the top of the feed if marked as high importance.