REST API

Live Documentation

https://raw.githubusercontent.com/openwisp/openwisp-notifications/docs/docs/images/api-docs.png

A general live API documentation (following the OpenAPI specification) is available at /api/v1/docs/.

Browsable Web Interface

https://raw.githubusercontent.com/openwisp/openwisp-notifications/docs/docs/images/api-ui.png

Additionally, opening any of the endpoints listed below directly in the browser will show the browsable API interface of Django-REST-Framework, which makes it even easier to find out the details of each endpoint.

Authentication

See openwisp-users: authenticating with the user token.

When browsing the API via the Live Documentation or the Browsable Web Interface, you can also use the session authentication by logging in the django admin.

Pagination

The list endpoint support the page_size parameter that allows paginating the results in conjunction with the page parameter.

GET /api/v1/notifications/notification/?page_size=10
GET /api/v1/notifications/notification/?page_size=10&page=2

List of Endpoints

Since the detailed explanation is contained in the Live Documentation and in the Browsable Web Interface of each point, here we'll provide just a list of the available endpoints, for further information please open the URL of the endpoint in your browser.

List User's Notifications

GET /api/v1/notifications/notification/

Available Filters

You can filter the list of notifications based on whether they are read or unread using the unread parameter.

To list read notifications:

GET /api/v1/notifications/notification/?unread=false

To list unread notifications:

GET /api/v1/notifications/notification/?unread=true

Mark All User's Notifications as Read

POST /api/v1/notifications/notification/read/

Get Notification Details

GET /api/v1/notifications/notification/{pk}/

Mark a Notification Read

PATCH /api/v1/notifications/notification/{pk}/

Delete a Notification

DELETE /api/v1/notifications/notification/{pk}/

List User's Notification Setting

GET /api/v1/notifications/notification/user-setting/

Available Filters

You can filter the list of user's notification setting based on their organization_id.

GET /api/v1/notifications/notification/user-setting/?organization={organization_id}

You can filter the list of user's notification setting based on their organization_slug.

GET /api/v1/notifications/notification/user-setting/?organization_slug={organization_slug}

You can filter the list of user's notification setting based on their type.

GET /api/v1/notifications/notification/user-setting/?type={type}

Get Notification Setting Details

GET /api/v1/notifications/notification/user-setting/{pk}/

Update Notification Setting Details

PATCH /api/v1/notifications/notification/user-setting/{pk}/

List User's Object Notification Setting

GET /api/v1/notifications/notification/ignore/

Get Object Notification Setting Details

GET /api/v1/notifications/notification/ignore/{app_label}/{model_name}/{object_id}/

Create Object Notification Setting

PUT /api/v1/notifications/notification/ignore/{app_label}/{model_name}/{object_id}/

Delete Object Notification Setting

DELETE /api/v1/notifications/notification/ignore/{app_label}/{model_name}/{object_id}/