Register a push subscription
const url = 'https://example.com/api/v1/notifications/subscriptions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"installation_id":"example","subscription":{"endpoint":"example","keys":{"auth":"example","p256dh":"example"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/notifications/subscriptions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "installation_id": "example", "subscription": { "endpoint": "example", "keys": { "auth": "example", "p256dh": "example" } } }'Save a push subscription for one Installation. The server checks the endpoint and encryption keys before it stores them. It returns no response body. Route: /api/v1/notifications/subscriptions. Inputs: . Do not automatically replay this operation after an uncertain result.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Stable random ID for one browser or app Installation.
Browser Push API subscription fields.
object
HTTPS endpoint from the browser Push API.
Encryption keys from the browser Push API.
object
URL-safe, unpadded auth secret.
URL-safe, unpadded P-256 public key.
Examplegenerated
{ "installation_id": "example", "subscription": { "endpoint": "example", "keys": { "auth": "example", "p256dh": "example" } }}Responses
Section titled “Responses”The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}