Could someone from Fitbit API take a look at the following issue. Looks like Sleep in the Time Series is not returning correct values and the dashboard seems to be showing different information.
https://community.fitbit.com/t5/Fitbit-com-Dashboard/Bug-Total-Sleep-Discrepancy/m-p/722832/highligh...
Answered! Go to the Best Answer.
Best Answer
@FedericoArg wrote:We are using the Time-Series API which should get the aggregated values for the entire day.
https://wiki.fitbit.com/display/API/API-Get-Time-Series
No, it shouldn't. You will note on that page it says: "1. Note that sleep collection resources represent values for the main sleep entry for the dates in request (this is the log entry labeled with "isMainSleep" = true)."
So it specifically only includes the primary sleep session.
@FedericoArg wrote:I mainly asking this because I am seeing a Bug in the Fitbit API when returning this information.
215 / 60 = 3.58 hours which does not match with what I slept that day (6.32hours)
{
"sleep-minutesAsleep": [
{
"dateTime": "2015-03-18",
"value": "215"
}
]
}
What API call are you using? You should be using API-Get-Sleep and looking at the "summary" section, which shows the total of all sleep sessions for the day, which should look like:
"summary":{
Best AnswerWe are using the Time-Series API which should get the aggregated values for the entire day.
https://wiki.fitbit.com/display/API/API-Get-Time-Series
sleep/minutesAsleep
sleep/awakeningsCount
sleep/minutesAwake
Best Answer
@FedericoArg wrote:We are using the Time-Series API which should get the aggregated values for the entire day.
https://wiki.fitbit.com/display/API/API-Get-Time-Series
No, it shouldn't. You will note on that page it says: "1. Note that sleep collection resources represent values for the main sleep entry for the dates in request (this is the log entry labeled with "isMainSleep" = true)."
So it specifically only includes the primary sleep session.
Thank you for pointing that to me.
Best AnswerI don't see that caveat at https://dev.fitbit.com/docs/sleep/#get-sleep-time-series. Was that an intentional omission?
Best Answer