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.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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.
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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Which endpoint are you calling?
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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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