Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
K0IN committed Jul 24, 2023
1 parent ca24e53 commit 4bba595
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 129 deletions.
171 changes: 99 additions & 72 deletions doc/api.md
Original file line number Diff line number Diff line change
@@ -1,142 +1,169 @@
# API DOC
# API Documentation

## Routes

All routes are prefixed with `/api`

## keys endpoint
---

### get vapid keys
## Notifications Endpoint

**URL** : `/api/keys`
### Send a Notification to All Devices

**Method** : `GET`
**URL**: `/api/notify`

**Auth required** : No
**Method**: `POST`

**Description** : get the server vapid key to create a client subscription
**Auth required**: Yes (only if the server password is set). Authentication
header must be `Bearer <serverpassword>`.

#### Success Responses
**Description**: Send a notification to all devices.

**Code** : `200 OK`

**Content** :
**Body**:

```json
{"successful":true,"data":"BGDRJjAeUMkFC1uFnqR0L5-VlqwV6RxhQedXid6CY95ONU3NCQI82-WvNWc2vc9HV8YOIAC9VsMrMhJhi3XS8MQ"}
{
"title": "<title>",
"message": "<message>",
"icon": "<optional icon url>",
"tags": ["<optional list of strings>"]
}
```

## device endpoint

### create a new device

**URL** : `/api/device`
#### Success Response

**Method** : `POST`
**Code**: `200 OK`

**Auth required** : no (only if the serverpassword is set) Authentication header must be `Bearer <serverpassword>`

**Description** : create a new device and return the device id with a secret that can be used to delete it later

**Body** :
**Content**:

```json
{
"web_push_data":{
"endpoint":"<endpoint url>",
"key":"<base64 encoded subscription p256 key>",
"auth":"<base64 encoded subscription auth>"
}
"successful": true,
"data": "notified"
}
```

#### Success Responses
---

**Code** : `200 OK`
## Keys Endpoint

**Content** :
### Get Vapid Keys

```json
{"successful":true,"data":{"id":"c968712190ec72e785160fe2a45b45a4","secret":"bd907b2a5f9e571949aa92561fcb5694"}}
```
**URL**: `/api/keys`

### Check if a device exists
**Method**: `GET`

**URL** : `/api/device/<device_id>`
**Auth required**: No

**Method** : `GET`
**Description**: Get the server Vapid key to create a client subscription.

**Auth required** : No
#### Success Response

**Description** : check if a device exists
**Code**: `200 OK`

#### Success Responses

**Code** : `200 OK`

**Content** :
**Content**:

```json
{"successful":true,"data":true}
{
"successful": true,
"data": "BGDRJjAeUMkFC1uFnqR0L5-VlqwV6RxhQedXid6CY95ONU3NCQI82-WvNWc2vc9HV8YOIAC9VsMrMhJhi3XS8MQ"
}
```

### Delete a device
---

**URL** : `/api/device/<device_id>`
## Device Endpoint

**Method** : `DELETE`
### Create a New Device

**Auth required** : No
**URL**: `/api/device`

**Description** : delete a device
**Method**: `POST`

**Body** :
**Auth required**: No (only if the server password is set). Authentication header must be `Bearer <serverpassword>`.

**Description**: Create a new device and return the device ID with a secret that
can be used to delete or update it later.

**Body**:

```json
{
"secret":"<device secret>"
"web_push_data": {
"endpoint": "<endpoint url>",
"key": "<base64 encoded subscription p256 key>",
"auth": "<base64 encoded subscription auth>"
}
}
```

#### Success Responses
#### Success Response

**Code** : `200 OK`
**Code**: `200 OK`

**Content** :
**Content**:

```json
{"successful":true,"data":"device deleted"}
{
"successful": true,
"data": {
"id": "c968712190ec72e785160fe2a45b45a4",
"secret": "bd907b2a5f9e571949aa92561fcb5694"
}
}
```

## Notifications endpoint
### Check If a Device Exists

### Send a notification to all devices
**URL**: `/api/device/<device_id>`

**URL** : `/api/notify`
**Method**: `GET`

**Method** : `POST`
**Auth required**: No

**Auth required** : yes (only if the serverpassword is set) Authentication header must be `Bearer <serverpassword>`
**Description**: Check if a device exists.

**Description** : send a notification to all devices
#### Success Response

**Body** :
**Code**: `200 OK`

**Content**:

```json
{
"successful": true,
"data": true
}
```

### Delete a Device

**URL**: `/api/device/<device_id>`

**Method**: `DELETE`

**Auth required**: No

**Description**: Delete a device.

**Body**:

```json
{
"title":"<title>",
"message":"<message>",
"icon":"<optional icon url>",
"tags": [<optional list of strings>]
"secret": "<device secret>"
}
```

#### Success Responses
#### Success Response

**Code** : `200 OK`
**Code**: `200 OK`

**Content** :
**Content**:

```json
{"successful":true,"data":"notified"}
```
{
"successful": true,
"data": "device deleted"
}
```

Empty file added doc/baremetal.md
Empty file.
Empty file added doc/deploy.md
Empty file.
9 changes: 0 additions & 9 deletions doc/development.md

This file was deleted.

7 changes: 0 additions & 7 deletions doc/frontend.md

This file was deleted.

15 changes: 11 additions & 4 deletions doc/install.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
# User's Guide: Installation

## Deploying to deno deploy 🚀
## Api Documentation 📚

The API is very simple and easy to use.
You can find the documentation [here](api.md).

## Deployment Options 🚀

### Deploying to deno deploy 🚀

If you don't want to host it yourself, you can deploy it to deno deploy.
Deno deploy enables easy and efficient deployment of application.
It is also free (as of now) and requires no credit card to get started.

[Learn more](install/deploy.md)

## Containerization with Docker 🐳
### Containerization with Docker 🐳

If you prefer containerization for your applications, Docker is the way to go.
Docker is a fast way to deploy the application on your own infrastructure.

[Learn more](install/selfhosted.md)
[Learn more](install/docker.md)

## Running on Bare Metal 💻
### Running on Bare Metal 💻

If you prefer to run the project on bare metal, you can do so as well.

Expand Down
37 changes: 0 additions & 37 deletions doc/wrangler.md

This file was deleted.

17 changes: 17 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ curl -X POST -H "Content-Type: application/json" -d '{"title":"Hello", "message"
Don't worry about complicated setups. The installation documentation is right here to help you get started with Notify in no time! 📚

👉 [Installation Documentation](doc/install.md)
👉 [Api Documentation](doc/api.md)

## Features 🎉

- Send push messages to any device that supports web push
- Easy installation with Docker, bare metal, or Deno Deploy
- Offline installable PWA
- Customize your notifications with optional features like adding an icon
- Open-source and free to use
- No registration required
- Easy to use API

## Need Help? 🤔

- Refer to our great [documentation](doc/install.md)
- Start a discussion on [GitHub Discussions](https://github.com/K0IN/Notify/discussions)
- Open an [new issue](https://github.com/K0IN/Notify/issues/new)

## Ready to Get Notified? 🚀

Expand Down

0 comments on commit 4bba595

Please sign in to comment.