25 May Issues while Integrating Fitbit API and Gethealth as its saviour
Fitbit provides a Web API for accessing data from Fitbit activity trackers, Aria scale, and manually entered logs. In this blog post I will touch down what issues you can face while integrating Fitbit api and how we resolved all these issues at gethealth.io which you need not to solve. The main goal of gethealth.io is to save all this developer time which he can put building the business logic of application , while forgetting about the all the technicalities of integrating and fetching the data.
Step 1: Signup for the Fitbit API Credentials.
You need to register you application to get the api crendentials to start using the Fitbit API. In this you also need to set and test the callback url which is needed for authorization process of user.
Step 2: Read Documentation of API and underlying authentication mechanism
Fitbit uses OAuth 2.0 for user authorization and API authentication. For API authentication it uses Authorization Code Grant and Implicit Grant and recommends Authorization Code Grant flow applications that have a web service.
You need to learn about Oauth 2.0 by which a user can give permission to access to his data via fitbit API. If you are familiar with OAuth 1.0a , the bad news is that fitbit had deprecated it. Figure below shows Authorization Code Grant Flow
And Implicit Grant Flow
Also you need to read all the Resources provided in the API documentation to start fetching data from API
Step 3: Find an OAuth 2.0 library for your programming language and framework to create an authorization flow.
Depending upon the programming language you use , you can find the appropriate library which supports Oauth 2.0 authentication mechanism and flow.
Step 4: Make API requests with the authorized user’s credentials.
This includes fetching the particular resource from the Fitbit API. In order to make API requests to the Fitbit API using OAuth 2.0, you need to add an
Authorization header to the HTTP request with the user’s access token.
These four steps described above can take considerable developer time and also will let developer to focus on the business logic of application. Gethealth.io can help you in this regard. Get health provides all this with few REST API calls. Using gethealth.io you need to follow below steps
Step 1: Signup for gethealth.io
Step 2: Integrate our Rest API.
For user authentication we have provided the REST API call which you just need to integrate in your Application and it handles all authentication mechanism itself (e.g Oauth 2.o for fitbit). Note before authentication of user you need to create that user account within gethealth.io so we can track there authentication access codes.
Step 3: Make API requests with user authorization token to fetch data across multiple user or single user.
We also provide Rest API calls which enable you to fetch data across multiple user using account call and for particular user using user call.Checkout out API documentation which let’s you get starting using the API in no time. E.g. the below api call fetches activities of a particular user:
In this blog post I described the steps which you need to deal with while accessing data using Fitbit API and also described how simply we can use gethealth.io to get the same data while reducing all the technical effort by the developer. Using gethealth the developer can focus on how he can focus on the data fetched from source. Also using gethealth developer can add data from hundreds of sources like misfit, Runkeeper, Strava and many more wearables and healthcare application using same implementation flow and need not to follow each sources development requirement. In coming blogs I will post interesting integration challenges about Misfit, Runkeeper, Googlefit and other application. Follow gethealth.io on twitter