Wearables

List the patient's wearable connections

  • Sandbox: available
  • Staging: available
  • Production: unknown
GET
/v1/wearables/connections

Returns the wearable providers the signed-in patient can connect, and when they connected each one.

Auth: bearer token of a patient. Scope: the caller's project and Patient profile (from the token).

Behaviour

  • connections holds one entry per provider the project has enabled, plus any provider the patient is still connected to after the project switched it off.
  • connection is null when the patient has not connected the provider. Otherwise:
    • connectedAt: when the patient last connected it;
    • syncedThrough: up to when its data has been synced, null before the first sync;
    • reconnectRequired: true when the provider no longer accepts the connection. Connect it again to clear it.
  • A session that is not a patient's answers 403 PATIENT_PROFILE_REQUIRED.

Example

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

Authorization

bearer
headerAuthorizationBearer <JWT>

Response Body

Each provider the patient can connect or is connected to.

application/json
  1. response
connections*array<>
Example Request
curl -X GET 'https://api.sandbox.ovok.com/v1/wearables/connections'
Example Response
{  "connections": [    {      "provider": "oura",      "connection": {        "connectedAt": "string",        "syncedThrough": "string",        "reconnectRequired": true      }    }  ]}

Remove a wearable provider DELETE

Removes your project's credentials for a wearable provider. **Auth:** bearer token of a project admin. **Scope:** the caller's project (from the token). ## Behaviour - Patients can no longer connect the provider. - Patients already connected keep their connection until they disconnect it. - For Polar, ovok also deletes the client's webhook at Polar when it points at this project's `webhookUrl`; a webhook pointing anywhere else is left alone. Should that fail, the credentials are removed all the same. - A provider not set up answers `404 PROVIDER_NOT_CONFIGURED`. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/wearables/providers/oura' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```

Start connecting a wearable provider POST

Starts connecting the signed-in patient's account at a wearable provider. Open the returned `authorizationUrl` in a browser or an auth session (`ASWebAuthenticationSession`, Custom Tabs) whose callback scheme is your patient app's. **Auth:** bearer token of a patient. **Scope:** the caller's project and Patient profile (from the token). ## Flow 1. The patient consents on the provider's page. 2. The provider sends the browser to `GET /v1/wearables/oauth/<provider>/callback`. 3. ovok exchanges the code for tokens, stores them encrypted, and redirects the browser (`302`) to the project's patient app at `/wearables/<provider>?result=connected|denied|failed`. ## Behaviour - The URL is valid for 10 minutes and for one use. - Polar shares data only for users registered to the app, so ovok registers the patient with Polar right after the code exchange. A patient who has not accepted Polar's mandatory consents is refused, and the callback ends with `result=failed`. - Connecting a provider the patient is already connected to replaces the stored tokens. - A provider the project has not set up or has switched off answers `404 PROVIDER_NOT_AVAILABLE`. - A project with no usable patient app URL (`PATIENT_APP_URL`) answers `409 APP_URL_NOT_CONFIGURED`: the flow would have nowhere to return to. - When the authorization cannot be stored, the answer is `503 STATE_STORE_UNAVAILABLE` with `Retry-After`. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/wearables/connections/oura/authorize' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```