Notifications API
Managing user notifications
Notifications API
Endpoints for managing user notifications, including approval requests, approval status updates, and other system notifications.
Base URL: https://ycwadelaide.adenmgb.com
Authentication: All endpoints require Authorization: Bearer <token> header.
Overview
The notifications system provides real-time updates about:
- Approval Requests - When content is submitted for approval
- Approval Approved - When content is approved and published
- Approval Rejected - When content is rejected with optional reason
- System Notifications - Other important system events
GET /api/staff/notifications
Retrieve notifications for the authenticated user.
Headers:
Query Parameters:
unreadOnly(optional) - Iftrue, returns only unread notifications. Default:false
Request Examples:
Success Response (200 OK):
Response Fields:
id- Notification IDtype- Notification type:"approval_request","approval_approved","approval_rejected"title- Notification titlemessage- Notification message with detailscontentType- Type of content:"actions","events","news","newsletters"contentId- ID of the content itemread- Boolean indicating if notification has been readcreatedAt- ISO 8601 timestamp when notification was createdreadAt- ISO 8601 timestamp when notification was marked as read (null if unread)
Error Responses:
- 401 Unauthorized - Not authenticated
- 500 Internal Server Error - Database error
Notes:
- Results are ordered by
createdAtDESC (newest first) - Use
unreadOnly=trueto get only unread notifications for badge counts - Notifications are automatically created by the system
POST /api/staff/notifications/:id/read
Mark a notification as read.
Headers:
URL Parameters:
id- Notification ID
Success Response (200 OK):
What Happens:
readis set totruereadAtis set to current timestamp
POST /api/staff/notifications/read-all
Mark all notifications as read.
Headers:
Success Response (200 OK):
Response Fields:
marked- Number of notifications marked as read
DELETE /api/staff/notifications/:id
Delete a notification.
Headers:
URL Parameters:
id- Notification ID
Success Response (200 OK):
Notes:
- This action cannot be undone
- Consider implementing a confirmation dialog
Notification Types
approval_request
Sent to approvers when content is submitted for approval.
Example:
approval_approved
Sent to content creator when their content is approved.
Example:
approval_rejected
Sent to content creator when their content is rejected.
Example:
Usage Examples
Get Unread Count:
Mark Notification as Read:
Mark All as Read:
Related APIs
- Approval APIs - Approval workflow
- Content APIs - Content management