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

Problem with date ranges

ANSWERED

I'm trying to integrate WebAPI into an App, but I'm getting errors in the FitBit API Explorer Swagger for any date format I try. Any ideas what I might be doing wrong?

 

Example:

Request URL:

https://api.fitbit.com/1/user/-/body/log/fat/date/2019-04-01/2019-05-30.json

Error:

{
"errors": [
{
"errorType": "validation",
"fieldName": "endDate",
"message": "Invalid end date: 2019-05-30"
}
]
}

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @ale_dev,

 

Welcome to the forums!

 

Thanks for bringing this error up, and I can see why it's being returned with your data parameters. According to our documentation, the max date range is 31 days. The date range you are querying in your endpoint appears to be greater than 31 days.

 

I can also see where the confusion is with Swagger UI as it does indicate that the options that can be returned for the Get Body Fat Logs are: 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. Nothing above 30d or 1m is supported (ie 3m, 6m, 1y). I'll create a ticket to have Swagger UI reflect the correct information shown in the documentation.

 

I hope this helps. Let me know if you have any additional questions.

View best answer in original post

Best Answer
6 REPLIES 6

Is there a maximum range period? 

Best Answer
0 Votes

The above might be an API problem or my understanding of it, but this timeseries call worked for me.

/1/user/-/body/weight/date/2020-01-04/max.json

Best Answer
0 Votes

Hi @ale_dev,

 

Welcome to the forums!

 

Thanks for bringing this error up, and I can see why it's being returned with your data parameters. According to our documentation, the max date range is 31 days. The date range you are querying in your endpoint appears to be greater than 31 days.

 

I can also see where the confusion is with Swagger UI as it does indicate that the options that can be returned for the Get Body Fat Logs are: 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. Nothing above 30d or 1m is supported (ie 3m, 6m, 1y). I'll create a ticket to have Swagger UI reflect the correct information shown in the documentation.

 

I hope this helps. Let me know if you have any additional questions.

Best Answer

Thanks for the helpful explanation, I was also confused by the options that didn't work (e.g. 3m, 6m, 1y, or max).

Best Answer
0 Votes
Best Answer
0 Votes

Hi @spacejumbofudge 

 

Thank you for bring this to our attention.   We will update the documentation with the date range.   For Get Weight Time Series by Date Range, the max range is 31 days.

 

Gordon

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