Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to start with Visual Studio 2012, ASP.NET, C#

ANSWERED

Hello,

I am developing a website using visual studio 2012 asp.net and C#. I am working on a similar idea as explained in fitbit API documents

"Website A wants to integrate with Fitbit.com so that Website A's users can integrate their Fitbit data into Website A. There is a user Joe, who has an account on both Website A and Fitbit.com. First, Joe allows Website A to access and modify his Fitbit data. Once this authentication occurs, Website A can freely make HTTP calls to get and to modify Joe's data. Website A can also subscribe to any changes in Joe's data. For instance, when Joe updates his daily step count or syncs the tracker device, Fitbit.com automatically notifies Website A of this change via an HTTP callback, thus Website A can fetch updated resources only when necessary"

But Actually I am confused how to start so is there any resource that help me understand step by step

Thanks,

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

If you download the Fitbit.NET API library I maintain on Github (lots of recent contributions -- thanks) it has a runnable sample website (ASP.NET C# MVC) that has the library referenced and a few examples of pulling data all in native code. You just need in insert a consumer key / consumer secret that you get from dev.fitbit.com in the Web.Config where the placeholders "YOU_CONSUMER_KEY" are.

 

There was someone else trying to run it with Visual Studio 2012 and having issues so I'd recommend you at least download the free Visual Studio 2013 editions or you can create a new website in 2012 and add in just the Fitbit library as a reference and start from scratch.

 

--Aaron

Using Fitbits in Research? Check out Fitabase --www.fitabase.com

View best answer in original post

Best Answer
10 REPLIES 10

Absolutely.

Check out https://wiki.fitbit.com/display/API/Fitbit+API

 

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer

Appreciated 🙂

Is there any video tutorials ?

Thanks,

 

Best Answer
0 Votes

Unfortunately there no any official Fitbit video tutorials. 

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

The Fitbit API is a web service API. This means that you can retrieve data via HTTP in the way that you can retrieve web pages in your browser.

 

The Fitbit API uses OAuth 1.0a for authentication. This means that in order for your application to retrieve data about a Fitbit user, that user has to give the application permission to access their data. Then, when your application wants to make an HTTP request, your application must send a special Authorization header that confirms it truly has permission to access the user's data.

 

Find an OAuth 1.0a library for your preferred language and framework. Create a user authorization flow to obtain user consent. Then make the HTTP requests with the OAuth Authorization header.

 

Aaron Coleman's .NET library is very popular.

Best Answer

If you download the Fitbit.NET API library I maintain on Github (lots of recent contributions -- thanks) it has a runnable sample website (ASP.NET C# MVC) that has the library referenced and a few examples of pulling data all in native code. You just need in insert a consumer key / consumer secret that you get from dev.fitbit.com in the Web.Config where the placeholders "YOU_CONSUMER_KEY" are.

 

There was someone else trying to run it with Visual Studio 2012 and having issues so I'd recommend you at least download the free Visual Studio 2013 editions or you can create a new website in 2012 and add in just the Fitbit library as a reference and start from scratch.

 

--Aaron

Using Fitbits in Research? Check out Fitabase --www.fitabase.com
Best Answer

@JeremiahFitbit wrote:

The Fitbit API is a web service API. This means that you can retrieve data via HTTP in the way that you can retrieve web pages in your browser.

 

The Fitbit API uses OAuth 1.0a for authentication. This means that in order for your application to retrieve data about a Fitbit user, that user has to give the application permission to access their data. Then, when your application wants to make an HTTP request, your application must send a special Authorization header that confirms it truly has permission to access the user's data.

 

Find an OAuth 1.0a library for your preferred language and framework. Create a user authorization flow to obtain user consent. Then make the HTTP requests with the OAuth Authorization header.

 

Aaron Coleman's .NET library is very popular.



Thank you so much for your explanation 🙂

Best Answer
0 Votes

@aarondcoleman wrote:

If you download the Fitbit.NET API library I maintain on Github (lots of recent contributions -- thanks) it has a runnable sample website (ASP.NET C# MVC) that has the library referenced and a few examples of pulling data all in native code. You just need in insert a consumer key / consumer secret that you get from dev.fitbit.com in the Web.Config where the placeholders "YOU_CONSUMER_KEY" are.

 

There was someone else trying to run it with Visual Studio 2012 and having issues so I'd recommend you at least download the free Visual Studio 2013 editions or you can create a new website in 2012 and add in just the Fitbit library as a reference and start from scratch.

 

--Aaron


Thanks alot I will follow your advice 🙂

Best Answer
0 Votes

I have downloaded the sample app and got it running but can go no further. Your second paragragh describes exactly what I need to know how to do. It just doesn't say how to do it. So how does my application make an http request and send a special authorization header? Also what part of the sample app code is considered the library that I would need to include in my application? Where do I find the OAuth 1.0a library for my preferred language and framework? How do I create a user authorization flow to obtain user consent?

Best Answer
0 Votes

Reem, I have been searching for a week for the same thing you are looking for. I also am looking for the step by step solution but so far I haven't found one. The documentation provides very little as to how to even begin.

Best Answer
0 Votes

@jschrimshire wrote:

I have downloaded the sample app and got it running but can go no further. Your second paragragh describes exactly what I need to know how to do. It just doesn't say how to do it. So how does my application make an http request and send a special authorization header? Also what part of the sample app code is considered the library that I would need to include in my application? Where do I find the OAuth 1.0a library for my preferred language and framework? How do I create a user authorization flow to obtain user consent?


@jschrimshire 

OK, lots of questions:

  1. The library handles the underlying HTTPS connections, you just call the methods in FitbitClient class. 
  2. The Authorization header is also abstracted. Again, you use the code to do this.
  3. Everything under Fitbit.NET in the solution is the library, everything in SampleMVCWeb is the sample website that we made that consumes the librray.
  4. OAuth is baked in.
  5. The Auth flow is in Authenticator.cs

All of that said, we've got a new fork of the library that we're going to introduce as the primary once OAuth 2.0 is out of beta. I did a quick video demo recently to show how that progress is coming and you might find that useful as a step-by-step. Much is similar to the existing stable library: https://www.youtube.com/watch?v=ggx-4SwuYm4

 

--Aaron

Using Fitbits in Research? Check out Fitabase --www.fitabase.com
Discussing some of the recent changes I've added 6/8/2015 to async-portable branch here: https://github.com/aarondcoleman/Fitbit.NET/tree/async-portable
Best Answer
0 Votes