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

Subscriptions - Responding to Notifications

ANSWERED

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?

  • activities:  /1/user/-/activities/date/{date}.json
  • body:        /1/user/-/body/date/{date}.json
  • sleep:       /1/user/-/sleep/date/{date}.json
  • foods:       /1/user/-/foods/log/date/{date}.json

Thanks,
Jeff

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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:

 

  • body:        /1/user/-/body/date/{date}.json
    • Correct endpoints are:
      /1/user/-/body/log/weight/date/{date}.json
      /1/user/-/body/log/fat/date/{date}.json
  • sleep:       /1/user/-/sleep/date/{date}.json
    • Correct endpoint:
      /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.

View best answer in original post

Best Answer
1 REPLY 1

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:

 

  • body:        /1/user/-/body/date/{date}.json
    • Correct endpoints are:
      /1/user/-/body/log/weight/date/{date}.json
      /1/user/-/body/log/fat/date/{date}.json
  • sleep:       /1/user/-/sleep/date/{date}.json
    • Correct endpoint:
      /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.

Best Answer