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

Get Sleep Logs by Date Range - get auto detected data

ANSWERED

May I know is there an API available for getting sleep data that are auto-logged by tracker just like  activities/tracker/steps? After referring to Fitbit Web API documentation only have get sleep log endpoint that gets all sleep data including manual log sleep data.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @forAppAnonymous,

 

Currently, there isn't a great way to differentiate sleep data that was automatically logged by a device or manually logged on the app.

 

Though, one of the ways you can identify if a sleep log was tracked by the device is to look for the sleep "type" in the JSON response. If the sleep was properly recorded by a sleep stage enabled device, it will show up as "stages" on the JSON response, like so:

 },
      "logId": 23372319092,
      "minutesAfterWakeup": 0,
      "minutesAsleep": 506,
      "minutesAwake": 68,
      "minutesToFallAsleep": 0,
      "startTime": "2019-08-05T22:34:30.000",
      "timeInBed": 574,
      "type": "stages"

If the device was manually logged, you can expect to see "classic" in that field. Alternatively, if the sleep stage enabled device did not get enough data to compile a sleep stage log, it will also show up as a "classic" sleep log in that field. Right now, there isn't a way to determine if a sleep log was manually logged vs if the device did not have a strong enough reading throughout the night to create a sleep stage log.

 },
      "logId": 23372319092,
      "minutesAfterWakeup": 0,
      "minutesAsleep": 506,
      "minutesAwake": 68,
      "minutesToFallAsleep": 0,
      "startTime": "2019-08-05T22:34:30.000",
      "timeInBed": 574,
      "type": "classic"

For more information on how Sleep Stages is tracked, please see our help article "What should I know about Sleep Stages"

 

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

View best answer in original post

Best Answer
0 Votes
3 REPLIES 3

Hi @forAppAnonymous,

 

The GET Sleep Logs endpoint that you are referring to pull sleep data that are both automatically logged by the device and manually logged on the app.

 

If you are referring to the type of data that the Activity Time Series offers, we did offer the v1 Sleep Time Series endpoints at one point but this has since been deprecated when moving to the v1.2 Sleep Stage endpoints.

 

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

Best Answer
0 Votes

Thanks for the info ,

1. Is there anyway we can differentiate sleep data that automatically logged by device and manual logged on the app for the GET Sleep Logs endpoint v1.2 ? 

 

2. Is there any way to only get those sleep data which auto logged by device.

Best Answer
0 Votes

Hi @forAppAnonymous,

 

Currently, there isn't a great way to differentiate sleep data that was automatically logged by a device or manually logged on the app.

 

Though, one of the ways you can identify if a sleep log was tracked by the device is to look for the sleep "type" in the JSON response. If the sleep was properly recorded by a sleep stage enabled device, it will show up as "stages" on the JSON response, like so:

 },
      "logId": 23372319092,
      "minutesAfterWakeup": 0,
      "minutesAsleep": 506,
      "minutesAwake": 68,
      "minutesToFallAsleep": 0,
      "startTime": "2019-08-05T22:34:30.000",
      "timeInBed": 574,
      "type": "stages"

If the device was manually logged, you can expect to see "classic" in that field. Alternatively, if the sleep stage enabled device did not get enough data to compile a sleep stage log, it will also show up as a "classic" sleep log in that field. Right now, there isn't a way to determine if a sleep log was manually logged vs if the device did not have a strong enough reading throughout the night to create a sleep stage log.

 },
      "logId": 23372319092,
      "minutesAfterWakeup": 0,
      "minutesAsleep": 506,
      "minutesAwake": 68,
      "minutesToFallAsleep": 0,
      "startTime": "2019-08-05T22:34:30.000",
      "timeInBed": 574,
      "type": "classic"

For more information on how Sleep Stages is tracked, please see our help article "What should I know about Sleep Stages"

 

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

Best Answer
0 Votes