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

Please tell me about "Web API Sleep"

ANSWERED

Nice to meet you.
My name is HIRO.

 

Please tell me about "Web API Sleep"

 

When I get the API sleep it doesn't contain the 'summary' of the 'type steges'. Please tell me if you know why.

The API date for the attached image is September 22, 2021. I am using Inspire2.

There were many other APIs around the same time that didn't all have a "summary".

 

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

The daily summary information you are requesting is only available for the Get Sleep Log by Date endpoint.  If a user has multiple sleep logs for the same date, then we will summarize the total daily sleep information at the bottom of the sleep log.  However, when retrieving sleep log data over a date range using either the Get Sleep Log by Date Range (which you are using) or Get Sleep Log List, the daily summary information is not available.  

 

If you examine the response for the endpoint you're calling, https://dev.fitbit.com/build/reference/web-api/sleep/get-sleep-log-by-date-range/#Response, you will see the daily summary is not included in the response description.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

View best answer in original post

Best Answer
8 REPLIES 8

Hi @Hirokazu 

 

I'm confused by what you're asking.   The summary information is shown by the 4 boxes you highlighted above.  It also correlates with the documentation examples.   Can you provide a little more information on what you expect to see?  

 

Thanks!

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Hi Gordon

Thank you for your comment.

 

All the API (JSON) data I got did not include the sleep summary.
I want to know why. Also, have there been such cases in the past?

Best Answer
0 Votes

Hi @Hirokazu 

 

I'm not aware of situations where the sleep response did not return the summary values.  Do you have an example?   The example you posted contains the summary values.

 

Screen Shot 2022-10-11 at 9.30.38 AM.png

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Hi Gordon

Thank you for your comment.

It is not the summary, but the absence of the summary that should be included in the yellow section.
All of the APIs I'm getting don't have the summary highlighted in yellow.
We are investigating the reason why only that part is missing from the API.

 

 

Best Answer
0 Votes

Which endpoint are you calling?

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Hi Gordon

Thank you for your comment.

 

I am connecting to this endpoint.
$url = "https://api.fitbit.com/1.2/user/{$participant->fitbit_user_id}/sleep/date/{$start_date}/{$end_date}.json";

Best Answer
0 Votes

The daily summary information you are requesting is only available for the Get Sleep Log by Date endpoint.  If a user has multiple sleep logs for the same date, then we will summarize the total daily sleep information at the bottom of the sleep log.  However, when retrieving sleep log data over a date range using either the Get Sleep Log by Date Range (which you are using) or Get Sleep Log List, the daily summary information is not available.  

 

If you examine the response for the endpoint you're calling, https://dev.fitbit.com/build/reference/web-api/sleep/get-sleep-log-by-date-range/#Response, you will see the daily summary is not included in the response description.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Hi Gordon

Thank you for your comment.
I will check the API again.

Best Answer
0 Votes