05-29-2015 08:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-29-2015 08:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
I was able to programmatically create a subscription using the FB subscription API, and I only have one endpoint set up in my app dashboard. It is marked as the default and enabled. My example optional subscriber-Id is ABC123, and that is also the FB UserId of a user I want to track. So, my endpoint receives the activity notifications of User ABC123. Awesome.
However, I don't really want an endpoint to be defined for each user. It may just be terminology that is confusing me, however I don't understand the link between the UserId and the subscription Id. What I want is just to have a few endpoints, maybe for broad categories, for multiple users. So, users LMN123, XSD123, and BNM123 should all be defined to receive activity updates under one endpoint subscriber Id. Can this be done, and what would my POST(s) in the Add Subscriptions API look like?
Kindly please don't refer me back to reading the Subscriptions API doc as I have from top to bottom and it is still not making sense. That's why I am posting this question.
Thanks for any help
Answered! Go to the Best Answer.

- Labels:
-
Subscriptions API
Accepted Solutions
05-29-2015 09:36 - edited 05-29-2015 09:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-29-2015 09:36 - edited 05-29-2015 09:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hello.
You can use the same endpoint for different users.
Simply when you add subscription via fitbit API request just use different ids, for instance:
https://api.fitbit.com/1/user/-/apiSubscriptions/subscriptionToUser1.json
https://api.fitbit.com/1/user/-/apiSubscriptions/subscriptionToUser2.json
...
https://api.fitbit.com/1/user/-/apiSubscriptions/subscriptionToUserN.json
of course you can replace subscriptionToUserN with any value you prefer.
Also even though you said you read wiki page about subscriptions api, I highly recommend it reading more then one time. It's not the easiest thing in the world I have to admit, but it has answers for all questions, including the question that you asked and I've just answered.
Senior Software Developer at Fitbit
05-29-2015 09:36 - edited 05-29-2015 09:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-29-2015 09:36 - edited 05-29-2015 09:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hello.
You can use the same endpoint for different users.
Simply when you add subscription via fitbit API request just use different ids, for instance:
https://api.fitbit.com/1/user/-/apiSubscriptions/subscriptionToUser1.json
https://api.fitbit.com/1/user/-/apiSubscriptions/subscriptionToUser2.json
...
https://api.fitbit.com/1/user/-/apiSubscriptions/subscriptionToUserN.json
of course you can replace subscriptionToUserN with any value you prefer.
Also even though you said you read wiki page about subscriptions api, I highly recommend it reading more then one time. It's not the easiest thing in the world I have to admit, but it has answers for all questions, including the question that you asked and I've just answered.
Senior Software Developer at Fitbit
05-29-2015 10:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-29-2015 10:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi Ivan,
Well, it seemingly does not get any easier than that! 🙂 Thank you for the clear explanation.
And I presume if I did have multiple endpoints defined and wanted to add a new subscriber to a specific endpoint I would just include that endpoint Id in the optional X-Fitbit-Subscriber-Id header?
Regards

05-29-2015 10:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-29-2015 10:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Correct.
Can you elaborate what exactly it not easier?
Senior Software Developer at Fitbit

05-29-2015 10:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-29-2015 10:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi Ivan,
There may be just a translation issue because I used a figure of speech. When I said that 'it seemingly does not get any easier than that' I meant that there is no way you could make it any easier to use and comprehend, that's all. Its already as easy as you can get.
I didn't understand that the SubscriberId was actually the last part of the string, as in your API docs under Add Subscriptions it shows ....320.json. I couldn't relate that the 320 was the subscriberId. In other API examples the full 6 character alpha code was used and that's what was throwing me. I am well on my way now.
Thanks for your help.
Regards

