Push

Remove a push device

  • Sandbox: available
  • On your own host? Choose https://{host} in the playground.
DELETE
/v1/push/devices/{id}

Removes one of your push devices: it gets no more push. Call it on sign-out.

Scope: the caller's own profile in the caller's project (from the token). A Patient, Practitioner or RelatedPerson session only; any other is 403 PROFILE_NOT_ALLOWED.

Behaviour

  • The answer is 204.
  • A device that is not yours, is in another project, or is already gone answers 404 PUSH_DEVICE_NOT_FOUND, the same in each case.
  • An id that is not a UUID is 422.
  • Deleting the account removes its devices too.

Example

curl -X DELETE 'https://api.sandbox.ovok.com/v1/push/devices/c3499c27-2973-0a7f-807e-fb8676a92dcb' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

id*string

The device id.

Formatuuid

Response Body

Removed: the device gets no more push.

Example Request
curl -X DELETE 'https://api.sandbox.ovok.com/v1/push/devices/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
Empty

Register a push device POST

Registers the device your app runs on for push, under your own profile. Call it after sign-in and again whenever the push token changes. The token is stored once and never returned. **Scope:** the caller's own profile in the caller's project (from the token). A Patient, Practitioner or RelatedPerson session only; any other is 403 `PROFILE_NOT_ALLOWED`. ## Behaviour - `token` is the push token the platform gave the app: an FCM registration token, an APNs device token (hex), or an Expo push token. Up to 4,096 printable characters, no spaces. - `platform` is `ios`, `android` or `web`. Anything else is 422. - `appId` is optional: the app the token belongs to, such as its bundle or package id. - A token new to the project answers **201** with `Location: /v1/push/devices/<id>`. - The same token again answers **200** with the device as it was, and the same `Location`. Registering on every app start is safe. - A token another profile of the project registered (someone else signed in on this device before) moves to you and answers 201: push for the earlier profile stops reaching this device. - The project's push provider (`/v1/push/provider`) decides which tokens it can send to. A token the provider later reports as no longer registered is removed on that send. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/push/devices' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]", "platform": "ios", "appId": "com.example.care" }' ```

Get the project's push provider GET

Returns the provider your current project sends push through, and what it is set up with. It never returns a secret. **Scope:** the caller's project (from the token). ## Behaviour - `provider` is `fcm`, `apns`, `expo` or `relay`, or `null` when none is set up. - `settings` shows the setup without its secret, or `null`: - `fcm`: `firebaseProjectId` and `clientEmail` from the service account key. - `apns`: `teamId`, `keyId`, `bundleId` and `environment`. - `expo`: `accessToken`, whether one is stored. - `relay`: `url`. - `secret` is always `null` here. A relay's signing secret is shown once, when it is set up. - A config stored with another server's key reads as not set up; set it up again with `POST`. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/push/provider' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).