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

Sense device stats are missing in API

Hi everyone. I've built an app integrated with Fitbit API, almost everything working fine, but there is a confusing issue. 

User about whom i'm going to tell is the only one who use Sense Fitbit device. User has passed Fitbit authorization flow associated with my app and provided all required scope (sleep, activity). User can see activity and sleep statistics on his Fitbit profile, but API doesn't return any meaningful information.

So the question is: what can be done wrong? Possibly I'm using incorrect API version.

Best Answer
0 Votes
3 REPLIES 3

Hi @Starasvetski 

 

I'm going to need a little more information to determine what the problem might be.   Would you please send me the exact API calls you're executing for activity and sleep?   Also, what type of response are you getting from the endpoints and what do you expect?

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

I'm using 

https://api.fitbit.com/1.2/user/-/sleep/date/2022-01-10.json

for sleep statistics and  

https://api.fitbit.com/2/user/-/activities/date/2022-01-10.json

for activities statistics.

Json I receive

{
	"activities": [],
	"goals": {
		"activeMinutes": 30,
		"caloriesOut": 1945,
		"distance": 5,
		"steps": 10000
	},
	"summary": {
		"activeScore": -1,
		"activityCalories": 0,
		"caloriesBMR": 1117,
		"caloriesOut": 1117,
		"distances": [
			{
				"activity": "total",
				"distance": 0
			},
			{
				"activity": "tracker",
				"distance": 0
			},
			{
				"activity": "loggedActivities",
				"distance": 0
			},
			{
				"activity": "veryActive",
				"distance": 0
			},
			{
				"activity": "moderatelyActive",
				"distance": 0
			},
			{
				"activity": "lightlyActive",
				"distance": 0
			},
			{
				"activity": "sedentaryActive",
				"distance": 0
			}
		],
		"fairlyActiveMinutes": 0,
		"lightlyActiveMinutes": 0,
		"marginalCalories": 0,
		"sedentaryMinutes": 1440,
		"steps": 0,
		"veryActiveMinutes": 0
	}
}

 But for current user I've expected at least

{
	"activities": [],
	"goals": {
		"activeMinutes": 30,
		"caloriesOut": 1945,
		"distance": 5,
		"steps": 10000
	},
	"summary": {
		"activeScore": -1,
		"activityCalories": 0,
		"caloriesBMR": 1117,
		"caloriesOut": 1117,
		"distances": [
			{
				"activity": "total",
				"distance": 2.73
			},
			{
				"activity": "tracker",
				"distance": 0
			},
			{
				"activity": "loggedActivities",
				"distance": 0
			},
			{
				"activity": "veryActive",
				"distance": 0
			},
			{
				"activity": "moderatelyActive",
				"distance": 0
			},
			{
				"activity": "lightlyActive",
				"distance": 0
			},
			{
				"activity": "sedentaryActive",
				"distance": 0
			}
		],
		"fairlyActiveMinutes": 0,
		"lightlyActiveMinutes": 0,
		"marginalCalories": 0,
		"sedentaryMinutes": 1440,
		"steps": 6546,
		"veryActiveMinutes": 0
	}
}

 

Best Answer
0 Votes

Hi @Starasvetski 

 

This is probably a typo when posting your questions, but double-check you're using version 1 of the activity endpoint.   You posted version 2.

 

Would you please verify the user id and client ID in the access token that you're using?   The access token is a JWT token, so you should be able to see the contents.    Sometimes during testing, people get mixed up with the user id that contains the data verses the user id that are querying in their application.   You can verify the user id in the app by following the instructions here: https://dev.fitbit.com/build/reference/web-api/troubleshooting-guide/common-solutions/#Data-Synchoni....   Once you get the user id in the app, you can match it to the one in the access token.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes