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

What does "get sleep logs" look like if sleep isn't logged?

I'm drafting my requirements specification document using Fitbit in a research study to monitor sleep.

 

I want to ask our technical team to use the get sleep logs API call on a daily basis so we can measure participant compliance with the study protocol - e.g., are they wearing their Fitbit at night like we've asked them to?

 

Calculating wear time at night is complicated, so I'm considering using isMainSleep data element as a simplifying factor. If we pull the logs and get isMainSleep = true, it means they've at least logged something. 

 

What does the get sleep logs API call look like if someone hasn't worn their Fitbit that night? Does the whole query return null or does each data element return as null? I need to tell our tech team what to look for as a negative result!

 

Thanks!

 

GET https://api.fitbit.com/1.2/user/[user-id]/sleep/date/[date].json

 

Best Answer
0 Votes
3 REPLIES 3

Hi @cwebster_nymbly,

 

If a sleep log isn't actually logged (automatically or manually) as in the user just did not wear the device to sleep, nothing will show for that day.

 

However, if a Fitbit user did wear the device to sleep, but the device did not have a strong heart rate reading, or low battery, you might be provided with a classic sleep log rather than a log with sleep stages. For more information on how devices track sleep, see: https://help.fitbit.com/articles/en_US/Help_article/2163.htm#

 

In the endpoint you provided, you can determine if the log was "classic" or "stages" by looking for the following element:

"type": "classic"

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

 

Best Answer
0 Votes

Thanks @JohnFitbit ! A follow-up question. Is the data element isMainSleep returned in a "classic" sleep log?

Or is that element only returned in a "stages" sleep log?

 

Thanks!

Best Answer
0 Votes

@cwebster_nymbly I believe that the isMainSleep element is returned for both sleep types. Are you only seeing this element in one type of sleep?

Best Answer
0 Votes