Skip to content

Designing REST API for push-notification #500

@GarlicB

Description

@GarlicB

I referenced kakao developers.

Default Setting
Host: https://api.absolute.com/v1.0
Authorization: FCM Server Key
Data Format : application/json

We use web-pushlib, and the push server key is fcm (firebase clouding message).

Detail
2-1. Registration
URL: /push/register
Method: POST
Params (all string type)
Endpoint: The id to receive the push.
p256dh: The public key that encrypts the payload between client and server.
auth: The authorization code.

On the client side, the user sends his own token (endpoint, p256dh, auth)
generated from the subscription to the server and stores it in database.

2-2. Unregistration
POST /push/unregister
Method: POST
Params:endpoint,p256dh,auth (same 2-1)
Response: 200 OK 'deleted tokens' <-log msg (example)

Delete the push token for a specific user.

2-3. Show tokens
URL: /push/tokens
Method: GET
Params: querystring 'auth'
auth: user's auth code(default value is null)

If the value of the params is 'null', the entire token list is displayed. (/push/tokens)
Or if you enter a specific auth value, it prints only the corresponding tokens.(/push/tokens?auth='***')

2-4. Send payload to user
URL: /push/send
Method: POST
Params: for_fcm
"for_fcm":{
"comment": "yay, it works",
"delay_while_idle":false,
"time_to_live":17200,
"priority":"high"
}

@romandev. Sorry for being late. I have redesigned it with more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions