01-03-2021 20:21
01-03-2021 20:21
In the WebAPI documentation, the section about responding to a subscription notification to retriev data - https://dev.fitbit.com/build/reference/web-api/subscriptions/#example-notifications
An example is give of retrieving the data for an "activities" notification as follows:
https://api.fitbit.com/1/user/184X36/activities/date/2010-03-01.json
Which implies that you should be able to fill in the components from the notification message like such:
https://api.fitbit.com/1/{ownerType}/{ownerId}/{collectionType}/date/{date}.json
Or, assuming that you are dealing with a user, and the user is the user who's token was used for authentication header:
https://api.fitbit.com/1/user/-/{collectionType}/date/{date}.json
Which is close, but not quite. The difference is with "foods". Can you confirm that these are the correct endpoints to call to respond to the notifications?
Thanks,
Jeff
Answered! Go to the Best Answer.
01-05-2021 16:32 - edited 01-07-2021 15:14
01-05-2021 16:32 - edited 01-07-2021 15:14
Hi @Jeff_New_Ocean,
Thanks for reaching out to clarify if the endpoints your listed are the correct ones to use for the notifications you mentioned. For the most part, it is correct, except for the following:
/1/user/-/body/log/weight/date/{date}.json
/1/user/-/body/log/fat/date/{date}.json
/1.2/user/-/sleep/date/{date}.json
There are plans to make the documentation clearer in regard to which endpoints should be called for each collection type, or simply make it easier to identify which scopes are needed for each collection type.
Thanks for continuing to shed light on what could be improved! Let me know if you have any other questions in the meantime.
01-05-2021 16:32 - edited 01-07-2021 15:14
01-05-2021 16:32 - edited 01-07-2021 15:14
Hi @Jeff_New_Ocean,
Thanks for reaching out to clarify if the endpoints your listed are the correct ones to use for the notifications you mentioned. For the most part, it is correct, except for the following:
/1/user/-/body/log/weight/date/{date}.json
/1/user/-/body/log/fat/date/{date}.json
/1.2/user/-/sleep/date/{date}.json
There are plans to make the documentation clearer in regard to which endpoints should be called for each collection type, or simply make it easier to identify which scopes are needed for each collection type.
Thanks for continuing to shed light on what could be improved! Let me know if you have any other questions in the meantime.