05-01-2020 07:21
05-01-2020 07:21
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"
}
]
}
Answered! Go to the Best Answer.
05-01-2020 14:09
05-01-2020 14:09
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.
05-01-2020 07:27
05-01-2020 07:27
Is there a maximum range period?
05-01-2020 07:33
05-01-2020 07:33
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
05-01-2020 14:09
05-01-2020 14:09
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.
05-01-2020 14:38
05-01-2020 14:38
Thanks for the helpful explanation, I was also confused by the options that didn't work (e.g. 3m, 6m, 1y, or max).
08-09-2022 16:11
08-09-2022 16:11
Is it me or is this still not fixed?
I hit the same issue. I don't see the limitation listed in the docs:
https://dev.fitbit.com/build/reference/web-api/body-timeseries/get-weight-timeseries-by-date-range/
https://dev.fitbit.com/build/reference/web-api/explore/#/Body%20and%20Weight/getWeightByDatePeriod
08-11-2022 06:27
08-11-2022 06:27
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