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

Need to get all clients fitbit data in one go from fitbit server using cron job

Hello,
I want to sync fitbit client data into application database using scheduler or cron job. So basically I want to perform following operations:

 

a) I have a list of clients with fitbit device Id's.
b) I want to save my all clients data into database and saved data will be shown on website like heart rate/health data etc.
c) I am able to get client data through single authentication but I need a way to get data in one go from fitbit api.
d) I am using c# application.
e) Please suggest a way to get all clients data from fitbit server in one go so that I can save same into my database.

 

This is quite urgent as I am developing health api system.

 

Thanks,

Best Answer
0 Votes
11 REPLIES 11

Any update on this?

Best Answer
0 Votes

Fitbit team please reply.

Best Answer
0 Votes

Hi @anusha.saxena

 

All of the Fitbit users whose data you want to store will need to authorize your application to their Fitbit data .  This is completed through an OAuth2 Authorization request.  Once the user has authorized access, your application will be able to fetch the user's data using the Web API calls.  We recommend implementing the subscription API so your application is notified when the user has new data to download instead of polling for new data.

 

Make certain you read the Platform Terms of Service to verify your application is in compliance.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Ok it means the process will be:

 

a) First user authenticate via fitbit userid and password with my web application.

b) Once authentication is done then application will be able to get fitbit client data.

c) fitbit user id and password is required to access fitbit data.

d) Only device Id will not provide data.

 

Please confirm.

 

Best Answer
0 Votes

When the Fitbit user authorizes sharing their data with your application, you'll receive an access token for that user.   This access token grants your application access to the Fitbit user's data.  You will not need the Fitbit user id and password to access the data.   Depending on the authorization grant flow used, your application may receive a refresh token which is used to obtain a new access token, maintaining access to the user's data.

 

A device ID is not used to retrieve data through the Web APIs.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

okay but fitbit user can only authorized using his fitbit user id and password right? 

Best Answer
0 Votes

Correct.  In your application when you prompt the user to share their Fitbit data, the user will need to sign in with their Fitbit credentials to complete the authorization flow.  We have a OAuth2 Tutorial you can walk through that demonstrates this process.   It can be found in https://dev.fitbit.com within your application settings

 

OAuth 2.0 Tutorial - Access Point.png

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Ok.

 

Now next question 🙂 how frequently we can get data from api. Suppose a user is performing activity within 5 sec/10 sec/15 sec then while making api calls can we get data with frequent api calls?

 

Because we will have 'n' no of users so data will load in bulk way.

 

Please suggest.

Best Answer
0 Votes

The rate limit for the APIs is 150 API calls per hour per user.   The Fitbit device will automatically sync with our servers every 15 minutes when it's near a bluetooth or wifi connection.  It's recommended that your application support the Subscriptions API so your application can be notified when a user has updated their data and retrieve the new data.   This should prevent the need to constantly poll our servers looking for new data.

 

 

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hi GordonFitBit,

Is it possible using Microsoft PowerBI to access FitBit users data once user consented or granted their access. ie. I have registered the PowerBI app dev.fitbit and OAuth2 but I have these questions:

1. get my organisation user to grant / consent access to their FitBit data?

2. from PowerBI app, how I can access or have PowerBI app connect to the consented access data?

Best Answer
0 Votes

@Newbie_FitBI

 

I provided a response here:

https://community.fitbit.com/t5/Web-API-Development/Organisation-Users-FitBit-Data-access-via-Micros...

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes