10-05-2022 21:49 - edited 10-19-2022 16:44
10-05-2022 21:49 - edited 10-19-2022 16:44
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".
Answered! Go to the Best Answer.
10-17-2022 13:40
10-17-2022 13:40
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
10-07-2022 06:45
10-07-2022 06:45
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
10-11-2022 04:42
10-11-2022 04:42
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?
10-11-2022 06:33
10-11-2022 06:33
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.
10-11-2022 16:55 - edited 10-19-2022 16:45
10-11-2022 16:55 - edited 10-19-2022 16:45
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.
10-11-2022 18:58
10-11-2022 18:58
Which endpoint are you calling?
10-12-2022 18:14
10-12-2022 18:14
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";
10-17-2022 13:40
10-17-2022 13:40
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
10-18-2022 18:02
10-18-2022 18:02
Hi Gordon
Thank you for your comment.
I will check the API again.