Get a wearable provider
- Sandbox: available
- Staging: available
- Production: unknown
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
curl -X GET 'https://api.sandbox.ovok.com/v1/wearables/providers/oura' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'bearerAuthorizationBearer <JWT>provider*string"oura""whoop""strava""withings""polar""suunto""garmin""ultrahuman"The provider, set up or not. Never a client or webhook secret; Withings' webhookUrl holds a per-project token, for admins only.
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 GET 'https://api.sandbox.ovok.com/v1/wearables/providers/oura'{ "provider": "oura", "configured": true, "enabled": true, "clientId": "string", "redirectUri": "string", "webhookUrl": "string", "webhookReady": true}Set up a wearable provider POST
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 1. 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. 2. Set its redirect URL to the provider's `redirectUri` from `GET /v1/wearables/providers`. ## Behaviour - `clientId` and `secret` are the app's OAuth client ID and secret. `secret` is never returned. - `subscriptionKey` is required for Suunto (its API-management subscription key) and refused for every other provider. - `webhookSecret` is 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 with `422 WEBHOOK_SECRET_NOT_USED`. Without it, ovok refuses Suunto's notifications and syncs Suunto only daily and on demand. - `enabled` defaults to `true`. - The credentials are encrypted before they are stored. A server that cannot encrypt answers `501` and stores nothing. - For Polar, when `enabled` is `true`, ovok then creates the client's webhook at Polar for the `SLEEP` and `ACTIVITY_SUMMARY` events, pointing at `webhookUrl`. Polar first sends it a `PING`, which ovok answers. ovok keeps the webhook's signing key with the credentials, encrypted and never returned. Should this fail, the credentials stay stored, `webhookReady` answers `false`, and saving them again retries. - A Polar client has one webhook. If it has one already for this project, ovok points it at `webhookUrl` and 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: `webhookReady` stays `false`; 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 with `PATCH`. A project changed by someone else while this request wrote also answers `409`; read it again and retry. - The answer is `201` with a `Location` header naming the provider. ## Example ```bash 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" }' ```
Change a wearable provider PATCH
Changes a wearable provider your project has already set up: its client ID, its secret, Suunto's subscription key or notification secret, or whether patients may connect it. **Auth:** bearer token of a project admin. **Scope:** the caller's project (from the token). ## Behaviour - Send at least one of `clientId`, `secret`, `subscriptionKey`, `webhookSecret` and `enabled`. Fields you leave out keep their value. - `webhookSecret` is Suunto's notification secret; change it here when you change it in the Suunto portal. Other providers answer `422 WEBHOOK_SECRET_NOT_USED`. - Changing Suunto's `clientId` keeps its `webhookSecret`. Send a new one in the same request if the new app signs with another secret. A secret the provider issued, like Polar's, belongs to its client and is replaced on a client change. - `enabled: false` stops new connections. Patients already connected stay connected and can still disconnect. - A provider not set up answers `404 PROVIDER_NOT_CONFIGURED`; set it up with `POST`. - Changing Withings' `clientId` to the one of ovok's own Withings device integration answers `422 CLIENT_ID_RESERVED`. - Changing Withings' `secret` keeps its `webhookUrl`: the URL's token comes from a secret ovok makes for the project, not from the client secret. Changing its `clientId` makes a new token, and so a new URL; patients connect again to the new app anyway. - For Polar, every change with `enabled: true` sets the webhook up again as `POST` does. `enabled: false` leaves the webhook in place; its notifications answer `404` until you switch Polar back on. ## Example ```bash curl -X PATCH 'https://api.sandbox.ovok.com/v1/wearables/providers/oura' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ```