Files
Zumri-Backend/Documentation/Notification-API.md
T
Isuru Bimsara 81d0e65686 first commit
2026-08-14 22:46:02 +05:30

2.5 KiB

Notification API

Create New Notification

Endpoint

POST: http://localhost:3070/api/notification

Request Body

{
  "notificationHeadline": "System Maintenance",
  "notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
  "notificationType": "ANNOUNCEMENT"
}

Respond

{
  "success": true,
  "message": "Notification created successfully",
  "notification": {
    "notification_id": "notif_1782553200000",
    "notificationHeadline": "System Maintenance",
    "notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
    "notificationType": "ANNOUNCEMENT",
    "dateCreated": "2026-06-27T05:30:00.000Z",
    "isActive": true,
    "updatedAt": "2026-06-27T05:30:00.000Z",
    "createdAt": "2026-06-27T05:30:00.000Z"
  }
}

Get Announcements

Endpoint

GET: http://localhost:3070/api/notification/announcements

Respond

{
  "success": true,
  "announcements": [
    {
      "notification_id": "notif_1782553200000",
      "notificationHeadline": "System Maintenance",
      "notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
      "notificationType": "ANNOUNCEMENT",
      "isActive": true,
      "dateCreated": "2026-06-27T05:30:00.000Z",
      "createdAt": "2026-06-27T05:30:00.000Z",
      "updatedAt": "2026-06-27T05:30:00.000Z"
    }
  ]
}

Get User Notifications

Endpoint

GET: http://localhost:3070/api/notification/user/:userId

Example:

GET: http://localhost:3070/api/notification/user/usr_12345

Respond

{
  "success": true,
  "notifications": [
    {
      "id": "userNotif_001",
      "user_id": "usr_12345",
      "notification_id": "notif_1782553200000",
      "isRead": false,
      "createdAt": "2026-06-27T05:30:00.000Z",
      "updatedAt": "2026-06-27T05:30:00.000Z",
      "notification": {
        "notification_id": "notif_1782553200000",
        "notificationHeadline": "System Maintenance",
        "notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
        "notificationType": "ANNOUNCEMENT",
        "isActive": true
      }
    }
  ]
}

Mark Notification As Read

Endpoint

PATCH: http://localhost:3070/api/notification/user/:userId/notification/:notificationId/read

Example:

PATCH: http://localhost:3070/api/notification/user/usr_12345/notification/notif_1782553200000/read

Respond

{
  "success": true,
  "message": "Notification marked as read"
}