Remove this browser's push subscription
me.push_subscription.delete
DELETE/api/v1/me/push-subscription
- Route
Removes your push subscription with this endpoint. Succeeds when there is none, and never touches a subscription that belongs to someone else.
Request body#
JSON, as application/json.
| Field | Description |
|---|---|
endpointstringrequired | The push service URL from the browser's PushSubscription. It must be on a known push service (Google, Mozilla, Apple or Microsoft) and use https. |
Response#
204 Removed, or there was nothing to remove. No body.
Errors#
Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.
| Status | Code | When |
|---|---|---|
400 | validation_failed | A field is missing, misspelled or out of range. details.fields lists each problem. |
401 | Read error.code | Described above. |
401 | unauthenticated | The request has no valid session. |
Examples#
These are real. Each was recorded from a sample household, the Okafors, running through the whole API when this site was built.
Remove this browser's push subscription
Request, curl
curl -X DELETE 'https://rigel.house/api/v1/me/push-subscription' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-d '{
"endpoint": "https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHn7s3kT0example"
}'Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/me/push-subscription", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
endpoint: "https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHn7s3kT0example",
}),
});
const data = await response.json();Request, HTTP
DELETE /api/v1/me/push-subscription HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
{
"endpoint": "https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHn7s3kT0example"
}Response, 204
HTTP/1.1 204 No Content
X-Request-Id: req_01M6V9CSTB7QK3S2MCVK9RJNYM