06-21-2021
11:02
- last edited on
06-23-2021
16:25
by
JohnFitbit
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-21-2021
11:02
- last edited on
06-23-2021
16:25
by
JohnFitbit
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
As of 6/16/2021 my host stopped getting sleep data. We request sleep as follows:
REQ:Method: GET, RequestUri: 'https://api.fitbit.com/1/user/-/sleep/date/2021-03-03.json', Version: 1.1, Content: <null>, Headers:
{
Authorization: Bearer <REDACTED>
}
but the returned content is:
RSP: StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Origin
Vary: Accept-Encoding
Fitbit-Rate-Limit-Limit: 150
Fitbit-Rate-Limit-Remaining: 125
Fitbit-Rate-Limit-Reset: 571
X-Frame-Options: SAMEORIGIN
CF-Cache-Status: DYNAMIC
cf-request-id: 0acfca85b60000930ae13ea000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
CF-RAY: 662cad1c5efd930a-SJC
Cache-Control: no-cache, private
Date: Mon, 21 Jun 2021 10:50:29 GMT
Server: cloudflare
Via: 1.1 google
Content-Language: en
Content-Type: application/json; charset=UTF-8
}
*************** RSP content: {"sleep":[],"summary":{"totalMinutesAsleep":0,"totalSleepRecords":0,"totalTimeInBed":0}}
The code for this area of our application hasn't been changed in years and was working fine up to 6/16/2021, although I'll be continuing to do isolated testing.
06-28-2021 06:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



06-28-2021 06:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Kevin_H
You're using a deprecated version of the Sleep API. The current version is 1.2. Please try this endpoint to see if the sleep data is returned.
https://api.fitbit.com/1.2/user/-/sleep/date/2021-03-03.json
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

06-28-2021 09:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-28-2021 09:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This project is a research study that's just now going live. It's quite
common for researchers to "play the home game" basically acting as
subjects, but they tend to be super non-compliant. In past projects I found
that when they started participating again my Fitbit data retrieval code
would bog the system down, so I added a 2-weeks-at-a-time throttle.
Unfortunately sleep data will never fill in, so anyone with more than 2
weeks of no sleep data would never get past the throttle.
I was aware of the 1.2 mods, I may have copied the wrong request from the
log. The specs seem to suggest that original sleep data and 1.2 data can be
returned, so we record both for secondary analyses.
Thank you for your help, and please close this thread.
Kevin Hollingshead
Research Software Engineer
*Arizona State University*
*College of Health Solutions*
*School of Nutrition and Health Promotion*
602-615-9972 (cell)

06-30-2021 14:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



06-30-2021 14:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Kevin_H
The devices store about 6-7 days of data. I'd recommend reducing your throttle to maybe 4-5 days.
Gordon
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

06-30-2021 17:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-30-2021 17:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Kevin Hollingshead
Research Software Engineer
*Arizona State University*
*College of Health Solutions*
*School of Nutrition and Health Promotion*
602-615-9972 (cell)

