10-24-2016 16:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-24-2016 16:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
My application is erroring out while doing the add subscription process with scope 'sleep'. I begin by deleted all subscriptions/access tokens from my app. I get the scopes for my user using the access token. Based on the scopes i start adding subscriptions using a for loop.
First interation of loop, it adds the 'body' subscription successfully.
Second iteration, i try to add the 'sleep' subcription and it throws a 409 .
I then try to manually unsub this user from sleep and i get a 404.
Can someone at fitbit check out my app and see what is going on? THanks
Below is my debug log:
[2016-10-24 16:14:06] FitbitLog.DEBUG: request {"type":"POST","path":"https://api.fitbit.com/1/user/-/body/apiSubscriptions/164866.json","params":{"headers":{"content-typ...":""}} []
[2016-10-24 16:14:06] FitbitLog.DEBUG: checkResponse {"response":"[object] (GuzzleHttp\\Psr7\\Response: {})","data":{"collectionType":"body","ownerId":"4TZ5RF","ownerType":"user","subscriberId":"1","subscriptionId":"164866"},"reason":"Created"} []
[2016-10-24 16:14:06] FitbitLog.DEBUG: request {"type":"POST","path":"https://api.fitbit.com/1/user/-/sleep/apiSubscriptions/164866.json","params":{"headers":{"content-ty...":""}} []
[2016-10-24 16:14:06] FitbitLog.DEBUG: checkResponse {"response":"[object] (GuzzleHttp\\Psr7\\Response: {})","data":{"collectionType":"body","ownerId":"4TZ5RF","ownerType":"user","subscriberId":"1","subscriptionId":"164866"},"reason":"Conflict"} []
Answered! Go to the Best Answer.

- Labels:
-
Subscriptions API
Accepted Solutions
10-24-2016 17:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



10-24-2016 17:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
A HTTP 409 Conflict error means the id of the subscription you've chosen has already been used by your application.
If you want to create two subscriptions for a user, each subscription id will need to be unique. You might use the format of `{fitbitUserId}-{collectionName}`, e.g. `26FWFL-sleep` for a POST https://api.fitbit.com/1/user/-/sleep/apiSubscriptions/26FWFL-sleep.json .
10-24-2016 17:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



10-24-2016 17:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
A HTTP 409 Conflict error means the id of the subscription you've chosen has already been used by your application.
If you want to create two subscriptions for a user, each subscription id will need to be unique. You might use the format of `{fitbitUserId}-{collectionName}`, e.g. `26FWFL-sleep` for a POST https://api.fitbit.com/1/user/-/sleep/apiSubscriptions/26FWFL-sleep.json .
