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

Sleep API - Sending notifications when the new sleep log is still processing

I have a question regarding the following section in the sleep logs API & subscriptions API:

https://dev.fitbit.com/build/reference/web-api/sleep/

 

Note: Some processing is asynchronous. If the system is still processing one or more sleep logs that should be in the response when this API is queried, the response will indicate a retry duration given in milliseconds. The "meta" response may evolve with additional fields in the future; API clients should be prepared to ignore any new object properties they do not recognize.

 

When this is happening, are sleep notifications still sent for the yet-to-be-completely-processed sleep logs?

We currently retrieve the sleep logs once we receive a notification from Fitbit, and upon requesting the data the new sleep event is not yet present. Is it possible to delay the sending of the notification until the sleep log has been completely processed and would be present in the response?


Kind regards,

Best Answer
0 Votes
3 REPLIES 3

Hi @Alegis 

 

The notification is sent as soon as the user syncs their data.  There may be some processing that occurs when calling the endpoint, that is not related to the data in the user's account.  

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

Hi Gordon,

 

Thank you for your answer. Considering the number of requests we may issue on behalf of users is limited, and you may want to reduce the load on your systems as well, I think it may be beneficial to delay sending the notification for sleep when the new data in that user's account for sleep is in fact not yet available. The goal of the subscriptions API is to notify systems when new data is available for that user.

A notification will trigger a response from other systems to start loading data, which is not there yet.

 

The benefits would be reduced load on your systems as well as reducing developer efforts to work around this limitation of data not yet being available; and prevent issues with data not being available yet or API limits being reached sooner.

Best Answer
0 Votes

Thanks for the feedback, @Alegis .   I'll provide your feedback to the engineering team.

 

Gordon

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