Skip to main content

Notifications

This guide explains how to interact with the Notifications API in the Sumaya369 web application. The API provides endpoints for managing customer notifications, including features for listing notifications, marking them as read, and deleting notifications.

List Notifications

Retrieve all notifications for the authenticated customer.

Endpoint

  • Method: GET
  • URL: /v1/customer/notifications

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Query Parameters

ParameterTypeDescriptionRequired
per_pageintegerNumber of items per pageNo

Success Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"number_of_notifications": "9+",
"notifications": {
"current_page": 1,
"data": [
{
"id": "5dfe70e6-e6e0-4648-9d73-a3639c92d652",
"created_at": "قبل ساعة",
"message": "ثم تسجيل الدخول على حسابك بجهازين او دولتين في اقل من ساعة",
"title": "تسجيل دخول مخالف",
"icon": "suspicious_login",
"status": "unread"
},
{
"id": "b33f5a60-a62f-4fd6-95a4-3cf0bb232547",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "مختصرات الحياة",
"icon": "course",
"status": "unread"
},
{
"id": "752e8b6a-3ecc-45c1-a23d-e69a9dfd5587",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "الخط الزمني",
"icon": "course",
"status": "unread"
},
{
"id": "8ce15454-1d0e-48bf-86e8-0ecb0b46370b",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "رسائل الحظ",
"icon": "course",
"status": "unread"
},
{
"id": "06ece07f-1a24-4c5c-b995-8ac5f0c39492",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "اسرار المحظوظين",
"icon": "course",
"status": "unread"
},
{
"id": "556307b2-29b7-4222-8530-beabfb4b9285",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "البومة الزرقاء",
"icon": "course",
"status": "unread"
},
{
"id": "4397f191-0436-4a0b-aa8a-6daaab36f6da",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "خطوط اليسر",
"icon": "course",
"status": "unread"
},
{
"id": "5160a2c2-3340-4e3f-8d43-9df939557d44",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "الرسائل الكونية",
"icon": "course",
"status": "unread"
},
{
"id": "53cd346a-e7aa-49b7-8c10-22742006c096",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "مختصر المشكلة",
"icon": "course",
"status": "unread"
},
{
"id": "bd15fca2-fbd7-4acd-9730-0e8f772fa341",
"created_at": "قبل أسبوع",
"message": "بقي 10 أيام على إنتهاء الإشتراك ",
"title": "شفرة الاختيار",
"icon": "course",
"status": "unread"
}
],
"first_page_url": "http://testing-api.sumaya369.net/v1/customer/notifications?page=1",
"from": 1,
"last_page": 18,
"last_page_url": "http://testing-api.sumaya369.net/v1/customer/notifications?page=18",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/notifications?page=1",
"label": "1",
"active": true
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/notifications?page=2",
"label": "2",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/notifications?page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://testing-api.sumaya369.net/v1/customer/notifications?page=2",
"path": "http://testing-api.sumaya369.net/v1/customer/notifications",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 172
}
},
"status_code": 200
}

Mark Notifications as Read

Mark specific notifications or all notifications as read for the authenticated customer.

Endpoint

  • Method: POST
  • URL: /v1/customer/notifications

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Request Body Parameters

ParameterTypeDescriptionRequired
read_allbooleanMark all notifications as readNo
idsarrayArray of notification IDs to mark as readNo*

*Either read_all or ids must be provided

Success Response

{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": null,
"status_code": 200
}

Delete Notifications

Delete specific notifications for the authenticated customer.

Endpoint

  • Method: DELETE
  • URL: /v1/customer/notifications

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Request Body Parameters

ParameterTypeDescriptionRequired
idsarrayArray of notification IDs to deleteYes

Success Response

{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}

Example Implementation Flow

  1. Notification Management
    • Application periodically fetches notifications using the list endpoint
    • Unread notifications count is displayed to the user
    • User can mark notifications as read individually or all at once
    • User can delete unwanted notifications

Key Considerations

  • Authentication is required for all endpoints
  • Notifications are personal to each customer
  • Unread notification count is capped at "9+" for display purposes
  • System supports both individual and bulk operations for marking as read
  • Deleted notifications cannot be recovered