Gamma API

Register a device for push

POST
/api/account/push/subscriptions

Stores one device of the caller's: a browser's Web Push subscription or an app's FCM token. Sending the same one again refreshes it; one last registered by somebody else becomes the caller's.

Who may call it: Any signed-in user, for their own account. API keys: no.

Authorization

session
cookiegamma.session_token<token>

The session cookie a sign-in sets. Over HTTPS its name carries the __Secure- prefix. Browsers send it on their own; other clients keep it from the sign-in response.

Request Body

application/json
  1. body
protocol*string
endpoint*string

The push service URL the browser was given.

Lengthlength <= 2048
keys*

Response Body

OK.

application/json
  1. response

One of the caller's devices. Never its endpoint or keys.

id*string

Unregister the device with it.

protocol*string
Value in"webpush""fcm"
createdAt*string
Formatdate-time
Example Request
curl -X POST 'http://localhost:3000/api/account/push/subscriptions' \  -H 'Content-Type: application/json' \  -d '{  "protocol": "webpush",  "endpoint": "string",  "keys": {    "p256dh": "string",    "auth": "string"  }}'
Example Response
{  "id": "string",  "protocol": "webpush",  "createdAt": "2019-08-24T14:15:22Z"}