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.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Best Answer