05-25-2017 10:37
05-25-2017 10:37
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
Answered! Go to the Best Answer.
05-31-2017 08:22
05-31-2017 08:22
@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
05-25-2017 12:21
05-25-2017 12:21
@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
05-25-2017 13:50
05-25-2017 13:50
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?
05-31-2017 08:22
05-31-2017 08:22
@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
05-31-2017 09:30
05-31-2017 09:30
@AndrewFitbit, never mind, I found that we are calling subscriptions endpoint incorrectly, we were appending userID to the path.
Now everything works.
Thanks.