This wrapper allows you to use the Health API; it supports OAuth authentication, setting up notifications and querying measurements.
It makes use of the ScribeJava OAuth client library and Play JSON for converting API results to Scala case classes.
Construct a WithingsClient using it's companion object. Provide the API key and secret.
To run authorize:
- Call
fetchAuthorizationUrlwhich will return the temporary tokens and the user authorization URL - Redirect user to the authorization URL
- On your callback URL the verified result will come back when it does call
requestAccessTokenwith the verified result and the temporary tokens obtained in step 1 - If all goes well you should've obtained a permanent API token and secret to use for other calls
To call a method:
Call either registerNotification or getMeasurements with the parameters you want and suply an implicit instance of WithingsAccessTokens to make an authorized call.
Start the server (io.ceratech.withings.rest), and provide the following environment variables:
API_KEYthe Withings API keyAPI_SECRETthe Withings API secret- optional
PORTthe REST server port (defaults to8080)
After starting open the following URL localhost:8080/api-docs/swagger.json to view the API docs (load them in a Swagger Editor/UI).