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

API returning wrong data

Hi,

 

We are having a problem with Fitbit API, it is returing data different than what we see in Fitbit dashboard.

 

We used this fitbit account - renushankar@ymail.com

 

Attached is the logger data for fitbit data.

 

On fitbit site for the above account there are data for the month of september. But it sends 1 data from the current date,which was not actually added.

 

fitbit-data-date.png 

 

 

Best Answer
0 Votes
25 REPLIES 25

Hello, 

please provide Fitbit API request URL you're making as well as Fitbit website page you comparing it to.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes
Ivan,
 
The API request URL is : 

where resource id, start date, and todays date are being filled in dynamically

 

  • the resource id has to do with the authentication process
  • the start date is the member's start date
  • and today is the current day the query is being issued
 
​And the website you are referring to is, www.fitbit.com
Account Email: renushankar@ymail.com
 
Thank you.
Best Answer
0 Votes

Please PM me with concrete API url and concrete page url you're comparing it to.

 

I know how the urls should look like. I need to investigate your concrete case.

This is why I need exact Fitbit Api url you're calling.

For the fitbit.com website you can just send me screenshot what you're seeng for the weight values.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Ivan,

 

I sent you a private message with the requested data above. Please let me know if you need any further information.

 

Appreciate your help.

Best Answer
0 Votes

Ok, so based on API request you sent me in PM it seems to me as a valid behavior.

The thing is that you're calling TimeSeries endpoint that supose to auto-fill the weight with the latest weights that user posted if there is not weight logged for particular date.

 

if you're interested in list of days when user actually entered his weight you need to use this format:

 

https://api.fitbit.com/1/user/{your_user_id_here OR -}/body/log/weight/date/2014-11-04/2014-11-11.json

instead of this

https://api.fitbit.com/1/user/{you_user_id_here OR -}/body/weight/date/2014-11-04/2014-11-11.json

see https://wiki.fitbit.com/display/API/API-Get-Body-Weight for more details.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Hello Ivan,

 

We changed the API calls to use the endpoint you suggested, but now we are seeing a different error:

Here is the exact call:

@OAuthRequest(GET, https://api.fitbit.com/1/user/2QX3TF/body/log/weight/date/2014-06-22/2014-11-13.json)

 

And here is the response:

{"errors":[{"errorType":"validation","fieldName":"endDate","message":"Invalid end date: 2014-11-13"}]}

 

Is this because this API has a limit of returning data for a maximum of 31 days ?

 

I saw that here: https://wiki.fitbit.com/display/API/API-Get-Body-Weight

end-date: Range end date when date range is provided. Note that period should not be longer than 31 day.

 

Thanks,


John

 

 

Best Answer
0 Votes

Yep.

The error message in response does not describes the problem very well, but yep you're right, you'll see this error response when you request for data for more then 31 days.

 

We have a ticket to fix the message to be more descriptive, so the error message should be returning valid explanation when we address the thicket.

 

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

to follow up on my previous post, what is the best practice, for say, retrieving 5 months of weight data ?

 

Should we run subsequent calls to /body/log/weight ?  Or is there an easier way ?

 

Thanks,

 

John

 

Best Answer
0 Votes

Yep, I'd suggest pulling by one month.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

If we do one month at a time, is there a limit on how frequently we can query and how many queries we can issue within a specific timeframe ?  Do we have to throttle our requests?

 

Also, Can you please explain again how the timeseries API is different from the log api.

I am looking here: https://wiki.fitbit.com/display/API/API-Get-Time-Series

/body/weight vs /body/log/weight

 

Thanks

Best Answer
0 Votes

@Khaled wrote:

If we do one month at a time, is there a limit on how frequently we can query and how many queries we can issue within a specific timeframe ?  Do we have to throttle our requests?

 


Please see https://wiki.fitbit.com/display/API/Rate+Limit

Best Answer
0 Votes

For the time series api's ....

The documentation page (https://wiki.fitbit.com/display/API/API-Get-Time-Series) is not very detailed. Can you please answer these additional questions:

 

1) what is the maximum date range for time series API -- in days ?  in months ?

 

2) is the data format the same as the /body/log/weight api ?  So we could process the response in the same exact way ?

 

 

Best Answer
0 Votes

Default limit is 150 requests per particular user per hour.

 

If you reach your limit for particular hour, you'll be able to make requests again when hour ends.

 

The main difference between weight log and time series is that time series normally returns only date+ value list. Where non-time series endpoint also return other useful information.

Some (not all though) endpoints may fullfill missing data, weight time series as you can see does it.

 

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

can you also please clarify on the difference between /body/weight vs /body/log/weight ? 

Best Answer
0 Votes

ok ... so in terms of filling missing data, can you please be more specific.

 

Is it repeating a weight value from the previous day if a value was not entered ?

 

So in effect, you see a weight value until a different value was entered by the user ?

Best Answer
0 Votes

@Khaled wrote:

ok ... so in terms of filling missing data, can you please be more specific.

 

Is it repeating a weight value from the previous day if a value was not entered ?

 

So in effect, you see a weight value until a different value was entered by the user ?


yes.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

.... and I am sure there is no specific way for us to detect that a weight value returned by time series API was filled in by the API or entered by the user.. right ?  Or is there a way 🙂

Best Answer
0 Votes

Unfortunately no, I posted above the only way you can do it for your use case .

You need to use non timeseries endpoint for that.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Hello Ivan,

 

One more question regarding the log api.  How far back can we query for data ?

 

Is it also a max of 1 year, as the timeseries api ?

 

Thanks,

 

John

Best Answer
0 Votes