Push

List your push devices

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

Lists the devices registered for push under your own profile in your current project. Tokens are 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

  • Each device has its id, platform, appId (or null) and registeredAt.
  • To find this device's id again, register its token once more: POST /v1/push/devices answers 200 with it.
  • Only your own devices are listed, never another person's.

Example

curl -X GET 'https://api.sandbox.ovok.com/v1/push/devices' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'

Authorization

bearer
headerAuthorizationBearer <JWT>

Response Body

The devices registered to you in this project. Never a token.

application/json
  1. response
devices*array<>
Example Request
curl -X GET 'https://api.sandbox.ovok.com/v1/push/devices'
Example Response
{  "devices": [    {      "id": "string",      "platform": "ios",      "appId": "string",      "registeredAt": "string"    }  ]}

Delete public resource token DELETE

Removes the public token from a resource, so it can no longer be read with `GET /public/{token}`. The resource itself is kept. ## Behaviour - The resource must be in the caller's project or one of its sub-projects. A resource of any other project, the parent project included, answers `403` and is left unchanged; an unknown id answers `404`. - Removes the `meta.extension` entry with the URL `https://api.ovok.com/fhir/StructureDefinition/public-resource-token`. Other extensions are kept. - Calling it on a resource without a token succeeds. - The response is `{ token: null, resource }` with the updated resource. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/public/DocumentReference/87ea5dfc-8b8e-384d-8489-79496e706390' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).

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" }' ```