03-08-2023 03:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-08-2023 03:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am making the request to creates a subscription to notify the application when a user has new data available. Followed by the docs here here but the response only pointed to activities collection-path. Do I miss anything?
curl --location --request POST 'https://api.fitbit.com/1/user/-/sleep/apiSubscriptions/dev001.json' \
--header 'X-Fitbit-Subscriber-Id: dev' \
--header 'Authorization: Bearer ACCESS_TOKEN'
{
"collectionType": "sleep",
"ownerId": "USERID",
"ownerType": "user",
"subscriberId": "dev",
"subscriptionId": "dev001"
}
{
"collectionType": "activities",
"ownerId": "USERID",
"ownerType": "user",
"subscriberId": "dev",
"subscriptionId": "dev001"
}
Answered! Go to the Best Answer.
Accepted Solutions
03-08-2023 19:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-08-2023 19:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I see the problem @Gordon-C
I use dev001 to create activities subscription before.
So I tried to use another subscription ID to create for sleep, eg USERID-sleep, and it worked!

03-08-2023 07:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



03-08-2023 07:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @jimmyhoang
When you try to create the subscription for sleep, what is the http status code returned along with the "activity" response? And, did you create the subscription for activity using the subscriptionId "dev001"?
Gordon
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

03-08-2023 18:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-08-2023 18:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
When you try to create the subscription for sleep, what is the http status code returned along with the "activity" response? 409
And, did you create the subscription for activity using the subscriptionId "dev001"? Yes, I did.
I made a call for activities using url:
https://api.fitbit.com/1/user/-/activities/apiSubscriptions/dev001.json
And then received the same response like above:
{ "collectionType": "activities", "ownerId": "USERID", "ownerType": "user", "subscriberId": "dev", "subscriptionId": "dev001" }

03-08-2023 18:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-08-2023 18:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
The docs indicates that 409 code means "Returned if the given user is already subscribed to this stream using a different subscription ID, OR if the given subscription ID is already used to identify a subscription to a different stream."
So I made a call to Get Subscription List:
https://api.fitbit.com/1/user/-/apiSubscriptions.json
Response:
{
"apiSubscriptions": [
{
"collectionType": "activities",
"ownerId": "USERID",
"ownerType": "user",
"subscriberId": "dev",
"subscriptionId": "dev001"
}
]
}
I hope this information is helpful for you to check.

03-08-2023 19:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-08-2023 19:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I see the problem @Gordon-C
I use dev001 to create activities subscription before.
So I tried to use another subscription ID to create for sleep, eg USERID-sleep, and it worked!

