Skip to content

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Withings

Modern .NET SDK for Withings generated from the provider's OpenAPI definition with AutoSDK.

Nuget package dotnet License: MIT Discord

Generated from the source spec

Built from a manually-crafted OpenAPI spec covering Withings's Health API so the SDK stays close to the upstream API surface.

Auto-updated

Designed for fast regeneration and low-friction updates when the upstream API changes without breaking compatibility.

Modern .NET

Targets current .NET practices including nullability, trimming, NativeAOT awareness, and source-generated serialization.

Docs from examples

Examples stay in sync between the README, MkDocs site, and integration tests through the AutoSDK docs pipeline.

Usage

using Withings;

// Pass your OAuth2 access token (see Authentication below)
using var client = new WithingsClient(accessToken);

Authentication

Withings uses OAuth 2.0 Authorization Code flow. This SDK handles API calls with a Bearer token — you are responsible for obtaining the access token via OAuth2.

Step 1: Register your application

Register at the Withings Partner Hub to get your client_id and client_secret.

Step 2: Redirect the user to authorize

https://account.withings.com/oauth2_user/authorize2
  ?response_type=code
  &client_id=YOUR_CLIENT_ID
  &state=RANDOM_STATE
  &scope=user.info,user.metrics,user.activity
  &redirect_uri=YOUR_CALLBACK_URL

Available scopes: user.info, user.metrics, user.activity, user.sleepevents

Step 3: Exchange the authorization code for tokens

POST https://wbsapi.withings.net/v2/oauth2
Content-Type: application/x-www-form-urlencoded

action=requesttoken
&grant_type=authorization_code
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&code=AUTH_CODE_FROM_CALLBACK
&redirect_uri=YOUR_CALLBACK_URL

The response contains access_token (valid ~3 hours) and refresh_token (valid ~1 year).

Step 4: Use the access token

using var client = new WithingsClient(accessToken);

// Get body measurements (weight, BP, SpO2, etc.)
var measurements = await client.Measure.MeasureGetmeasAsync(...);

// Get sleep summary
var sleep = await client.Sleep.Sleepv2GetsummaryAsync(...);

// Get daily activity (steps, calories)
var activity = await client.Activity.Measurev2GetactivityAsync(...);

Step 5: Refresh tokens

POST https://wbsapi.withings.net/v2/oauth2
Content-Type: application/x-www-form-urlencoded

action=requesttoken
&grant_type=refresh_token
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&refresh_token=YOUR_REFRESH_TOKEN

Ecosystem maintenance

This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.

Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.

Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.

Support

Bugs

Open an issue in tryAGI/Withings.

Ideas and questions

Use GitHub Discussions for design questions and usage help.

Community

Join the tryAGI Discord for broader discussion across SDKs.

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.

About

.NET SDK for Withings Health API - body measurements, sleep, activity, heart rate, ECG, and SpO2

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages