08-17-2015 15:32 - edited 08-17-2015 15:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-17-2015 15:32 - edited 08-17-2015 15:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've created an oauth2.0 client for your web service. I've been successful authorizing users and pulling their data from the server (although refresh never seems to work, but that's another story). Now I want to try a subscription service. I've added my endpoint url and subscriber id to the application page. So I've got:
- Implement a simple subscriber endpoint as described in Receiving Update Notifications.
- Make sure your subscriber endpoint is accessible from fitbit.com servers.
- Configure your subscriber endpoints as described in Configure your account with a subscriber endpoint.
Now I want to subscribe to a user. Do I use the same exact oauth process I created for data access mentioned above? If so, will the same callback get called (i.e. my callback I added for oauth2.0)? If so, what should I look for in the response that ensures that the user has granted the subscription and what do I use going forward for that particular user? The pull method uses the access_token, do I use the same thing for this user as well? How does the subscription_id link to a particular user? The documentation is very confusing.
Edit: I've tried authenticating my logged in user and that works. Then I send https://api.fitbit.com/1/user/-/apiSubscriptions/1111/activities.json and I'm receiving error 500:
{"errors":[{"errorType":"request","fieldName":"500","message":"An error occurred with the Fitbit API while processing the request. Please contact api@fitbit.com for assistance. Please reference error id: CF9A0A7F:F1F7_6CA8FE40:01BB_55D264A8_A37B8A26:1F92"}],"success":false}
Answered! Go to the Best Answer.

- Labels:
-
JavaScript
-
OAuth 2.0
-
Subscriptions API
Accepted Solutions
08-17-2015 16:41 - edited 08-17-2015 16:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-17-2015 16:41 - edited 08-17-2015 16:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Ok, answered my own questions. I assign my own subscriber_id to all users and I use the access token in the header to make the call.
08-17-2015 16:41 - edited 08-17-2015 16:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-17-2015 16:41 - edited 08-17-2015 16:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Ok, answered my own questions. I assign my own subscriber_id to all users and I use the access token in the header to make the call.
12-11-2016 16:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-11-2016 16:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
The documentation is confusing. I have used webhooks before from various 3rd party applications. What I am trying to figure out and don't understand is: You have to set it up for every user? So I am creating a web application for a group of users (thousands of them) that have fitbit devices. I thought I could setup a subscription for my application. Users are already allowing permission via oauth2. I assumed the subscription I had setup will be called when one of the users (assoicated with my application) updated their info (or the device updated it). This is confusing. Are you saying I have to manually create a subscription (by hand in the portal) for every user? If this is the case, I will have to just implement a polling system on our side.

