DocsoPWA15. REST API Endpoints
Developer

15. REST API Endpoints

oPWAorravo.com/docs/opwa/15-rest-api-endpoints

Base namespace: opwa/v1

POST /wp-json/opwa/v1/beacon

Record an analytics event from the front-end.

Request body (JSON):

json{
  "event":     "page_view",
  "sw_active": true,
  "url":       "https://site.com/blog/"
}

Response:

json{ "ok": true }

Authentication: None required (permission_callback: __return_true). Data is rate-limited by the server at the DB level (one row per date per event type).


POST /wp-json/opwa/v1/subscribe

Register a push subscription endpoint.

Request body (JSON):

json{
  "endpoint": "https://fcm.googleapis.com/fcm/send/…",
  "keys": {
    "p256dh": "BN…",
    "auth":   "zq…"
  }
}

Response:

json{ "ok": true, "id": 17 }

POST /wp-json/opwa/v1/unsubscribe

Remove a push subscription.

Request body (JSON):

json{ "endpoint": "https://fcm.googleapis.com/fcm/send/…" }

Response:

json{ "ok": true }

15. REST API Endpoints — oPWA Docs — Orravo