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

409 returned on sleep subscription

ANSWERED

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"} []

 

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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 .

View best answer in original post

Best Answer
1 REPLY 1

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 .

Best Answer