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

I don't understand how to subscribe multiple users to a subscription Id?

ANSWERED

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

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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.

Ivan Bahdanau
Senior Software Developer at Fitbit

View best answer in original post

Best Answer
4 REPLIES 4

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.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer

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

Best Answer
0 Votes

Correct.

Can you elaborate what exactly it not easier?

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

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

Best Answer
0 Votes