Subscribe the current user’s browser/device to push notifications.
The method stores or updates a push subscription using the browser Push API subscription data: endpoint, key_p256dh, and key_auth. If a subscription with the same endpoint already exists, it is reactivated and updated with the latest keys.
The number in the URL path (/1/) is the organization identifier — referred to as account_id.
This value must match the account associated with the provided session_id.
This endpoint supports both:
GET https://api.doboard.com/42/push_subscribe?session_id=abc123xyz&endpoint=https%3A%2F%2Ffcm.googleapis.com%2Ffcm%2Fsend%2Fexample-endpoint&key_p256dh=BNcRdreALRFXTkOOUHK1Et...&key_auth=BTBZMqHH6r4Tts7J_aSIgg
In this example:
42 is the organization/account IDendpoint is the browser/device push service endpoint.key_p256dh is the public encryption key from the browser push subscription.key_auth is the authentication secret from the browser push subscription.session_id=abc123xyz is used for authentication.If the account ID in the URL does not match the account tied to the session, the request will be rejected.
Required
The method requires a valid authenticated session:
session_id – authenticated user session.Guest access via
tokenis not supported.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
session_id |
string | Yes | – | Authenticated user session ID. |
endpoint |
string | Yes | – | Push service endpoint URL. Maximum length: 1024 characters. |
key_p256dh |
string | Yes | – | Public encryption key from the browser push subscription. Maximum length: 255 characters. |
key_auth |
string | Yes | – | Authentication secret from the browser push subscription. Maximum length: 255 characters. |
{
"data": {
"push_subscription_id": 123,
"operation_status": "SUCCESS"
}
}
| Field | Type | Description |
|---|---|---|
push_subscription_id |
int | ID of the created or updated push subscription. |
operation_status |
string | Operation result. Returns SUCCESS on successful subscription. |
| HTTP Code | error_no |
Message | Description |
|---|---|---|---|
401 |
– | Unauthorized |
Missing or invalid session_id. |
200 |
8501 |
endpoint is required |
endpoint parameter is missing or empty. |
200 |
8502 |
key_p256dh is required |
key_p256dh parameter is missing or empty. |
200 |
8503 |
key_auth is required |
key_auth parameter is missing or empty. |
200 |
8504 |
endpoint is too long |
endpoint is longer than 1024 characters. |
200 |
8505 |
key_p256dh is too long |
key_p256dh is longer than 255 characters. |
200 |
8506 |
key_auth is too long |
key_auth is longer than 255 characters. |
ACTIVE.status = ACTIVE.push_subscription_id.