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

What is correct way to retrieve users subscriptions?

ANSWERED

User should be subscribed to only 'activities' collection.

However tries to get list of his subscriptions fail:

1) call to GET /1/user/-/apiSubscriptions/xxxxxxx.json returns 403 'Forbidden. This application does not have permission to access nutrition data....'

2) call to GET /1/user/-/activities/apiSubscriptions/xxxxxx.json returns 405 'Method Not Allowed'

 

Is there any valid way to know if user is subscribed or not?

 

Thanks,

Maksym

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@MaksymSBW To get all subscriptions, a user has to have all scopes allowed, otherwise the call results in a 403. There isn't a way to call all subscriptions specific to your app unless you call them individually.

 

I'm not sure what you mean by "definitely allowed" because a user can select/deselect whatever scopes they want. If you're trying to look at a particular collection, then you use:

GET /1/user/-/{collection-path}/apiSubscriptions.json
Andrew | Community Moderator, Fitbit

What motivates you?

View best answer in original post

Best Answer
0 Votes
4 REPLIES 4

@MaksymSBW Your GET request should look like this:

GET /1/user/-/{collection-path}/apiSubscriptions.json

 

If you're doing GET /1/user/-/apiSubscriptions.json --> that's for all of them at once. So if a user didn't grant access to a particular scope (nutrition in this case), then you'll get a 403.

 

https://dev.fitbit.com/docs/subscriptions/#getting-a-list-of-subscriptions

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Thanks for prompt response.

 

So if I understand correctly it is not possible to get all subscriptions that are allowed for our app for a user? As I don't know what scopes user allowed and what he opted out for my app, right?

 

And what about second part? Why can't I get a status of specific subscription that should be definitely allowed?

 

 

Best Answer
0 Votes

@MaksymSBW To get all subscriptions, a user has to have all scopes allowed, otherwise the call results in a 403. There isn't a way to call all subscriptions specific to your app unless you call them individually.

 

I'm not sure what you mean by "definitely allowed" because a user can select/deselect whatever scopes they want. If you're trying to look at a particular collection, then you use:

GET /1/user/-/{collection-path}/apiSubscriptions.json
Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

@AndrewFitbit, never mind, I found that we are calling subscriptions endpoint incorrectly, we were appending userID to the path.

 

Now everything works.

 

Thanks.

Best Answer