AccountPreferences
Register a device for push
POST
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.
sessioncookie
gamma.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.
application/json- body
protocol*stringendpoint*stringThe push service URL the browser was given.
Length
length <= 2048keys*OK.
application/json- response
One of the caller's devices. Never its endpoint or keys.
id*stringUnregister the device with it.
protocol*stringValue in
"webpush""fcm"createdAt*stringFormat
date-timeExample 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"}