Set up a wearable provider
- Sandbox: available
- Staging: available
- Production: unknown
Stores your project's OAuth app at a wearable provider, so the project's patients can connect their accounts.
Auth: bearer token of a project admin. Scope: the caller's project (from the token).
Before you call it
- Register an app in the provider's developer program. Garmin, Suunto and Polar approve apps before they work. For Suunto, subscribe the app to the Cloud API product to get its subscription key, both shown on your Suunto profile page.
- Set its redirect URL to the provider's
redirectUrifromGET /v1/wearables/providers.
Behaviour
clientIdandsecretare the app's OAuth client ID and secret.secretis never returned.subscriptionKeyis required for Suunto (its API-management subscription key) and refused for every other provider.webhookSecretis Suunto's notification secret, the one set beside its notification URL in the Suunto developer portal. It is optional, never returned, and refused for every other provider with422 WEBHOOK_SECRET_NOT_USED. Without it, ovok refuses Suunto's notifications and syncs Suunto only daily and on demand.enableddefaults totrue.- The credentials are encrypted before they are stored. A server that cannot encrypt answers
501and stores nothing. - For Polar, when
enabledistrue, ovok then creates the client's webhook at Polar for theSLEEPandACTIVITY_SUMMARYevents, pointing atwebhookUrl. Polar first sends it aPING, which ovok answers. ovok keeps the webhook's signing key with the credentials, encrypted and never returned. Should this fail, the credentials stay stored,webhookReadyanswersfalse, and saving them again retries. - A Polar client has one webhook. If it has one already for this project, ovok points it at
webhookUrland switches it back on. When ovok does not hold that webhook's signing key, which Polar shows only once, ovok replaces the webhook to get a new key. A webhook pointing at another project, or anywhere else, is left alone:webhookReadystaysfalse; give each project its own Polar client. - Withings with the client ID of ovok's own Withings device integration answers
422 CLIENT_ID_RESERVED: register an app of your own. - A provider already set up answers
409 PROVIDER_CONFIGURED; change it withPATCH. A project changed by someone else while this request wrote also answers409; read it again and retry. - The answer is
201with aLocationheader naming the provider.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/wearables/providers' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "provider": "oura", "clientId": "your-client-id", "secret": "your-client-secret" }'bearerAuthorizationBearer <JWT>application/json- body
provider*string"oura""whoop""strava""withings""polar""suunto""garmin""ultrahuman"clientId*stringThe OAuth client ID of the project's app at the provider.
1 <= length <= 500secret*stringThe OAuth client secret. Never returned.
1 <= length <= 2000subscriptionKey?stringSuunto only: the app's API-management subscription key. Never returned.
1 <= length <= 2000nullwebhookSecret?stringSuunto only: the notification secret set in Suunto's portal, to check its notifications. Never returned.
1 <= length <= 2000nullenabled?booleanWhether the project's users may connect this provider.
trueThe provider after the change; Location names it.
application/json- response
provider*string"oura""whoop""strava""withings""polar""suunto""garmin""ultrahuman"configured*booleanWhether the project holds credentials for this provider.
enabled*booleanWhether its users may connect it: configured and switched on.
clientId*stringThe OAuth client ID, or null when not configured.
redirectUri*stringThe callback URL to register in the provider's developer portal; null when this server has no APP_BASE_URL.
webhookUrl*stringWhere the provider sends notifications, to paste in its developer portal where it asks for one. Withings' ends in a per-project token, so it is shown to admins only. Null when the provider sends none, is not set up, its webhook secret is not stored yet, or this server has no APP_BASE_URL.
webhookReady*booleanWhether ovok holds the secret that checks this provider's notifications, so they are accepted: Polar's signing key from its webhook setup, Withings' generated URL secret, or the Suunto secret the admin sent. False until then, such as after a failed Polar webhook setup. Null when the provider sends no notifications.
curl -X POST 'https://api.sandbox.ovok.com/v1/wearables/providers' \ -H 'Content-Type: application/json' \ -d '{ "provider": "oura", "clientId": "string", "secret": "string"}'{ "provider": "oura", "configured": true, "enabled": true, "clientId": "string", "redirectUri": "string", "webhookUrl": "string", "webhookReady": true}List the project's wearable providers GET
Returns every cloud wearable provider ovok supports, and whether your current project has set each one up. It never returns a secret. **Auth:** bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy. **Scope:** the caller's project (from the token). ## Behaviour - `providers` lists `oura`, `whoop`, `strava`, `withings`, `polar`, `suunto`, `garmin` and `ultrahuman`. - `configured` is `true` when the project holds OAuth credentials for the provider that this server can read. Credentials stored with another key read as not configured; set them up again with `POST`. - `enabled` is `true` when the provider is configured and switched on. Only then can the project's patients connect it. - `clientId` is the OAuth client ID, or `null`. - `redirectUri` is the callback URL to register in the provider's developer portal, the same for every project. It is `null` when this server has no public base URL. - `webhookUrl` is where the provider sends notifications of new data, unique to the project. For Withings it ends in a per-project token that proves a notification's origin, so only admins see it; keep it private. Paste it where the provider's portal asks for one (Suunto). For Withings and Polar it is for information only: ovok registers it itself. It is `null` when the provider sends no notifications (Oura, Whoop, Strava, Garmin and Ultrahuman for now), is not set up, or this server has no public base URL. See `POST /v1/wearables/webhooks/<projectId>/<provider>`. - `webhookReady` is `true` when ovok holds the secret that checks the provider's notifications: Polar's signing key from its webhook setup, the secret ovok makes for Withings, or Suunto's `webhookSecret`. It is `false` until then, so a Polar webhook setup that failed shows here; save Polar again to retry. It is `null` when the provider sends no notifications. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/wearables/providers' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Get a wearable provider GET
Returns one wearable provider of your current project, set up or not, in the shape of `GET /v1/wearables/providers`. It never returns a secret. **Auth:** bearer token of a project admin. **Scope:** the caller's project (from the token). ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/wearables/providers/oura' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```