09-02-2015 07:40
09-02-2015 07:40
I am unable to parse the json object for user information returned from fitbit API using Auth2. The error saying there is "features" element in josn object which I am taking it into consideration. I checked API documentation in "https://dev.fitbit.com/docs/user/" and the example for user json object doesn't have any features in it.
Is there a way to get latest json object for all fitbit APIs?
09-02-2015 11:21
09-02-2015 11:21
What do you mean by "features"?
09-02-2015 12:23
09-02-2015 12:23
when using this call: GET https://api.fitbit.com/1/user/[user-id]/profile.json, the json response object has "features" in one of the elements and that's why parsing the object is failing because it's looking for "features". Documentation has this user object:
{
"user": {
"aboutMe":<value>,
"avatar":<value>,
"avatar150":<value>,
"city":<value>,
"country":<value>,
"dateOfBirth":"<value>,
"displayName":<value>,
"distanceUnit":<value>,
"encodedId":<value>,
"foodsLocale":<value>,
"fullName":<value>,
"gender":<FEMALE|MALE|NA>,
"glucoseUnit":<value>,
"height":<value>,
"heightUnit":<value>,
"locale":<value>,
"memberSince":<value>,
"nickname":<value>,
"offsetFromUTCMillis":<value>,
"startDayOfWeek":<value>,
"state":<value>,
"strideLengthRunning":<value>,
"strideLengthWalking":<value>,
"timezone":<value>,
"waterUnit":<value>,
"weight":<value>,
"weightUnit":<value>
}
}
while response I am getting from fitbit which doesn't match the documentaion is:
{
"user":{
"age":35,
"avatar":""
"avatar150":"",
"averageDailySteps":0,
"dateOfBirth":"",
"displayName":"",
"distanceUnit":"METRIC",
"encodedId":"",
"features":{},
"foodsLocale":"en_US",
"fullName":"",
"gender":"FEMALE",
"glucoseUnit":"en_US",
"height":152.4,
"heightUnit":"METRIC",
"locale":"en_US",
"memberSince":"",
"offsetFromUTCMillis":,
"startDayOfWeek":"SUNDAY",
"strideLengthRunning":,
"strideLengthWalking":,
"timezone":"America/Los_Angeles",
"topBadges":[],
"waterUnit":"en_US",
"waterUnitName":"fl oz",
"weight":40,
"weightUnit":"METRIC"
}
}
Is there a way to get the latest fitbit json object for all the calls to prevent application failing?
Thanks
09-02-2015 15:35
09-02-2015 15:35
Fitbit reserves the ability to add fields without notice. This is our primary strategy for making backwards incompatible changes without requiring apps to update integrations constantly. Your JSON parsing should account for this.
I don't have a response object definition for every endpoint. We are working on a Swagger definition, but don't have anything to share at this time.