This post is about using FITBIT API’s and access them using C#.NET. FitBit documentation is a 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
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.