Register a push device
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
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
tokenis 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.platformisios,androidorweb. Anything else is 422.appIdis 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
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" }'bearerAuthorizationBearer <JWT>application/json- body
token*stringThe push token the device was given: FCM, APNs (hex) or Expo. Never returned.
^[\x21-\x7E]+$1 <= length <= 4096platform*stringThe device platform.
"ios""android""web"appId?stringThe app the token belongs to, such as its bundle or package id; null when not sent.
^[A-Za-z0-9._:-]+$1 <= length <= 255nullThe token was already registered to you.
application/json- response
id*stringThe device id, the id of its FHIR Basic.
platform*string"ios""android""web"appId*stringregisteredAt*stringWhen the device was registered to this profile.
curl -X POST 'https://api.sandbox.ovok.com/v1/push/devices' \ -H 'Content-Type: application/json' \ -d '{ "token": "string", "platform": "ios"}'{ "id": "string", "platform": "ios", "appId": "string", "registeredAt": "string"}List your push devices GET
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 ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/push/devices' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Remove a push device DELETE
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 ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/push/devices/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```