absolute icon indicating copy to clipboard operation
absolute copied to clipboard

Designing REST API for push-notification

Open GarlicB opened this issue 8 years ago • 1 comments

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.

GarlicB avatar Oct 28 '17 16:10 GarlicB

@GarlicB Thank you for this. But you missed some parameter information. Please add the info in more details. Also, I'm not sure if we need /push/event API in server side.

/cc @daehyunjimmy @JayChl

romandev avatar Oct 30 '17 23:10 romandev