Call FitBit API using C#

FitBit integration is pretty easy since FitBit documentation is very detailed one and easy to pick up. In order to call FitBit apis, you need to register yourself on their development platform and do a handshake with token-based authentication. FitBit uses token-based authentication for the webbased application. So I am using asp.net MVC application as the web client.

First register yourself and get Client ID and Client secret key

https://dev.fitbit.com

Once you have registered yourself and created the application on fitbit dev environment, you will see your application below :-

As a developer, we need client ID, Client secret and callback url. We will save this information in config files. We prepare the user to redirect to Fitbit.com to prompt them to authorize this app, on successful authentication we will call the required apis from FitBit and get the data.

More info on webapi calls with request and response on FitBit website — https://dev.fitbit.com/build/reference/web-api/basics/

Once we run out webapp, we need to go to its login page. This login page is going to FitBit api, does a handshake.

We are passing same clientid and client secret for authentication.

On successful handshake, we will see our profile data from fitbit. FitBit also gives, user activity like daily steps, weekly steps, heart rate data. But that will be there for another post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.