05-26-2018 13:44
05-26-2018 13:44
In the web api documentation, under sleep logs: https://dev.fitbit.com/build/reference/web-api/sleep/
It says that you can get one of these two responses:
- stages: Levels data is returned with 30-second granularity. 'Sleep Stages' levels include deep, light, rem, and wake.
- classic: Levels data returned with 60-second granularity. 'Sleep Pattern' levels include asleep, restless, and awake.
I'm accessing my sleep data through the api (using python) like this:
client.sleep(date=datetime.date(2018,04,20))
and only getting the classic response.
I've also tried
client.time_series(resource="sleep",period='1d') client.intraday_time_series(resource="sleep")
both returned an "Invalid time series resource path: /sleep" error
I have a fitbit alta hr and in the app i can see the sleep stages in detail (REM, deep etc.) -
How can I access them through the API?
05-30-2018 16:48
05-30-2018 16:48
I'm assuming you're receiving the "Invalid time series resource path: /sleep" because you're trying to use a sleep time series endpoint which doesn't exist.
Would you use the Web API Explorer tool, https://dev.fitbit.com/build/reference/web-api/explore/, to confirm that you're getting back the sleep stages?
05-31-2018 08:32
05-31-2018 08:32
@GordonFitbit I can't authenticate in the website, i get this error:
Developer information: invalid_request - Invalid redirect_uri parameter value
Is there any other way to access this inforamtion?
03-08-2019 00:59
03-08-2019 00:59
How can I get a time serie of REM minutes for instance ? is there a direct call ? the sleep part of the API is not super clear (compared to activities for instance)
03-11-2019 11:30
03-11-2019 11:30
Hi @cyrillm,
The options we have available are the endpoints
These endpoints will display the rem sleep and the timestamp. Unlike the Activities Time Series, we group the same sleep levels occurring consecutively.
04-16-2019 18:54
04-16-2019 18:54
Hello,
I am using fitbit-python library to access fitbit API.
```res = auth_client.time_series('sleep', base_date=start_date, end_date=end_date)```
I am accessing sleep range log data by this path:
/sleep/date/2017-04-02/2017-04-08.json
' as instructed in the fitbit website ('https://dev.fitbit.com/build/reference/web-api/sleep/')
However, I am only receiving sleep data excluding sleep stages (deep, rem, light.. )
any help?
thanks
04-16-2019 19:15
04-16-2019 19:15
Hi @skim88
There are several reasons why you may only get classic sleep information instead of sleep stages
1. Back in 2017, do you know if this user had a device that supported heart rate and sleep stages?
2. The sleep wasn't long enough to calculate sleep stages. The minimum is around 3 hours.
3. The sleep data was manually entered.
etc.
Would you have this user confirm in their Fitbit dashboard that sleep stage information is present by selecting one of the sleep logs?
04-16-2019 19:32
04-16-2019 19:32
04-18-2019 15:10
04-18-2019 15:10
Hi Seho,
Would you please try executing the same endpoint using the Web API Explorer tool? Here's the link: https://dev.fitbit.com/build/reference/web-api/explore/. First, authorize yourself by clicking on the "authorize" button and selecting all of the scopes. Then execute the endpoint "Get Sleep Logs by Date Range" /1.2/user/-/sleep/date/{base-date}/{end-date}.json and let me know if you get the same results.
Gordon
04-20-2019 13:58
04-20-2019 13:58
04-21-2019 11:04
04-21-2019 11:04
thanks for this - I changed my api call, but the result I get only holds the classic results : for instance
04-23-2019 17:23
04-23-2019 17:23
Hi @skim88
I'm not sure why the python library is not working for you. We don't directly support those libraries. My recommendation would be to contact the developer of the library and request help. I can help arm you with information. If you reproduce the problem again, and private message me your client ID, the time you recreated the problem, and the user id you're using, I'll see what information we have in our logs that you can send to the developer.
Gordon
04-23-2019 17:27
04-23-2019 17:27
Hi @cyrillm
What type of device are you using to track your sleep?
04-24-2019 01:12
04-24-2019 01:12
05-01-2019 09:59 - edited 05-01-2019 10:00
05-01-2019 09:59 - edited 05-01-2019 10:00
Hi @cyrillm ,
Check the data in your Fitbit dashboard on 2019-02-08 to see if the tracker stored the data as a classic sleep. If it did, the APIs will not convert it to staged sleep.
Gordon
05-03-2019 09:02
05-03-2019 09:02
GET https://api.fitbit.com/1.2/user/[user-id]/sleep/date/[startDate]/[endDate].json
is the endpoint I am trying to execute.
I couldn't send a private message, it says I have reached the limit for sending private message after sending one..
05-03-2019 09:12
05-03-2019 09:12
Hi @skim88,
Thank you for sending me the endpoint and your user id. It appears your tracker is recording the sleep stages in your account correctly. Have you tried executing the endpoint using the Web API Explorer, https://dev.fitbit.com/build/reference/web-api/explore/? See if the data is coming back correctly here. This will help determine if the problem is related to the Web APIs or the python library you're using.
05-03-2019 09:30
05-03-2019 09:30
Hi Gordon,
I have tried the Web API explorer and was able to get what I wanted.
We had this conversion:
04-23-2019 17:23
Hi @skim88
I'm not sure why the python library is not working for you. We don't directly support those libraries. My recommendation would be to contact the developer of the library and request help. I can help arm you with information. If you reproduce the problem again, and private message me your client ID, the time you recreated the problem, and the user id you're using, I'll see what information we have in our logs that you can send to the developer.
Gordon
I was hoping to figure out what is going on with the library.
Thanks,
05-03-2019 11:22
05-03-2019 11:22
If the data is coming back correctly with the Web APIs, then I'm going to assume the problem is with the python library. The OAuth libraries are not owned or supported by Fitbit. I would recommend you reach out to the developer of the OAuth library to get assistance.