10-08-2020 08:40
10-08-2020 08:40
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,
10-10-2020 20:22
10-10-2020 20:22
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.
10-10-2020 20:33 - edited 10-10-2020 20:36
10-10-2020 20:33 - edited 10-10-2020 20:36
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.
10-10-2020 22:29
10-10-2020 22:29
Thanks for the feedback, @Alegis . I'll provide your feedback to the engineering team.
Gordon