mk7-docs/docs/rest/notifications/notifications.md

4.7 KiB

layout title nav_order parent
default Notifications 103 WiFi Pineapple REST Documentation

Notifications

{: .no_toc }

Table of Contents

{: .no_toc .text-delta }

  1. TOC {:toc}

Introduction

The notifications system allows modules or other tools to communicate with the WiFi Pineapple user via the UI. You may specify a notification level, message, and optionally the name of the module that sent the notification.

Endpoints

Create Notification PUT /api/notifications

Request Body

```json { "level": number, "message": string, "module_name": string } ```

Response

If successful, returns success state:
```json { "success": true } ```
If unsuccessful: [See REST Error Responses](../../errors/errors)
Get Notifications GET /api/notifications

Response

If successful, returns an array of notifications:
```json [{ "id": number, "message": string, "level": number, "time": string, "read": bool, "displayed": bool, "module_name": string }] ```
If unsuccessful: [See REST Error Responses](../../errors/errors)
Delete All Notifications DELETE /api/notifications

Response

If successful, returns success state:
```json { "success": true } ```
If unsuccessful: [See REST Error Responses](../../errors/errors)
Delete Notification DELETE /api/notifications/:notificationId

Response

If successful, returns success state:
```json { "success": true } ```
If unsuccessful: [See REST Error Responses](../../errors/errors)
Mark All Notifications as Read PUT /api/notifications/read

Response

If successful, returns success state:
```json { "success": true } ```
If unsuccessful: [See REST Error Responses](../../errors/errors)
Mark Notification as Read PUT /api/notifications/:notificationId/read

Response

If successful, returns success state:
```json { "success": true } ```
If unsuccessful: [See REST Error Responses](../../errors/errors)
Mark Notification as Displayed PUT /api/notifications/:notificationId/displayed

Response

If successful, returns success state:
```json { "success": true } ```
If unsuccessful: [See REST Error Responses](../../errors/errors)