08-26-2019 02:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-26-2019 02:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm getting an error when trying to get sleep logs by Date Range. I'm trying to use this endpoint: https://dev.fitbit.com/build/reference/web-api/sleep/#get-sleep-logs-by-date-range
I do this exact call.
GET https://api.fitbit.com/1.2/user/-/sleep/date/2019-8-19/2019-8-28.json
And I get the following response.
{ "errors": [ { "errorType": "validation", "fieldName": "date", "message": "Invalid date: 2019-8-19/2019-8-28" } ] }
Answered! Go to the Best Answer.
Accepted Solutions
08-26-2019 10:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



08-26-2019 10:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Mariusl
To resolve this error, you need to specify a 2-digit value for month. The correct syntax for date values with the Web APIs are YYYY-MM-DD. Please try executing your endpoint as
GET https://api.fitbit.com/1.2/user/-/sleep/date/2019-08-19/2019-08-28.json
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

08-26-2019 10:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



08-26-2019 10:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Mariusl
To resolve this error, you need to specify a 2-digit value for month. The correct syntax for date values with the Web APIs are YYYY-MM-DD. Please try executing your endpoint as
GET https://api.fitbit.com/1.2/user/-/sleep/date/2019-08-19/2019-08-28.json
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

08-26-2019 23:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-26-2019 23:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
The missing padding on month was the mistake. Thanks!

