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

Getting previous data

ANSWERED

How far back can I request sleep data of a user, through the Rest API?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @onesimo,

 

Welcome to the forums!

 

When testing the sleep logs by date range endpoint with a date range of 2017-01-01 to 2021-01-01, I get the following error:

 

{
  "errors": [
    {
      "errorType": "validation",
      "fieldName": "endDate",
      "message": "Max date range is  100 days"
    }
  ]

I hope this helps!

View best answer in original post

Best Answer
3 REPLIES 3

Hi @onesimo,

 

Welcome to the forums!

 

When testing the sleep logs by date range endpoint with a date range of 2017-01-01 to 2021-01-01, I get the following error:

 

{
  "errors": [
    {
      "errorType": "validation",
      "fieldName": "endDate",
      "message": "Max date range is  100 days"
    }
  ]

I hope this helps!

Best Answer

Thank you

Best Answer
0 Votes

The range can be up to 100 days, but you can request data for a "practically" unlimited period in the past. There is a date when the user joined FitBit(you can get that date in the prile endpoint), and since then there is a possibility to receive data. However, if you request for a period before that date, you will not get an error, but rather an empty result set.

Best Answer
0 Votes