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

Nutrition log: loggedFood changed unexpectedly to logged_food

ANSWERED

In the Fitbit Web API documentation, the logged food JSON key is called 'loggedFood', but we now see in user data that this has changed to "logged_food":

{"foods":[{"logId":36982634939,"logged_food":{"foodId":0,

Can this be fixed, to match with the description in the documentation, or should we change it in our app?

Best Answer
1 BEST ANSWER

Accepted Solutions

Engineering has rolled back the change that caused the response element names to change.  The problem should be resolved.

View best answer in original post

Best Answer
12 REPLIES 12

Some fields within the logged_food have also changed to snake_case, including mealTypeId, nutritionalValues, and accessLevel. But foodId is still camelCase so it's not consistent.

Best Answer

We see that this issue with logged_food, and meal_type_id etc., doesn't happen for all Fitbit users. We can't reproduce it on our test devices. But for example for user with id CBMNZH the JSON fields are changed when we request the data. 

If more information is needed (for Fitbit support) please let me know.

Best Answer

We even see that with a user the nutrition data almost every time is using 'logged_food' (and the other _ variants) but sometimes for the same request and same response, it uses 'loggedFood' (changed the date because date format used in JSON is not allowed on this forum):

{"foods":[{"isFavorite":false,"logDate":"..August 5...","logId":36986929041,"loggedFood":{"accessLevel":"PUBLIC","amount":1,"brand":"","calories":323,"foodId":537131397,"locale":"de_DE",

And an hour later when we do the same request and no new nutrition data is available, so exactly the same response (with another order of the fields):
{"foods":[{"logId":36986929041,"logged_food":{"foodId":537131397,"access_level":"PUBLIC","locale":"de_DE", .... "logDate":"...August 5...","is_favorite":false,

Best Answer

Thank you for posting this problem.   I'm currently looking into it.

Best Answer

I have filed a bug to engineering.  I'll respond here with what I find out.

Best Answer
Best Answer

The problem is when water is logged in the mobile app, the water data is not returned by the Get Water Log endpoint.  This could have a wide-spread issue with 3P applications that pull water data from Fitbit.  If you create a water log with the Create Water Log endpoint, the water data is returned by Get Water Log.

Best Answer
0 Votes

yes we are also experiencing a ton of user complaints because their food is not syncing as the properties have been suddenly changed!  Can they please be changed back?

 

Best Answer
0 Votes

are you referring to the property names being changed? I am not sure I understand why logging water could cause property names to change?

Best Answer
0 Votes

Hi @trevor_chong I think there is a mix in this topic: it is about nutrition data and changed field names in the Fitbit JSON response, I think @GordonFitbit accidentally wrote a comment about the water intake issue (which I reported in another topic) in this topic. Gordon already mentioned that the issue is being reported as a bug to Fitbit engineering, so let's hope there is a fix soon.

Best Answer
0 Votes

@GordonFitbit  any updates?  We already patched the modified property names in our system, but now it seems the meal types are an issue where our code that relies on that model coming back is not receiving proper info to classify the meal types (breakfast, lunch, dinner).

 

Best Answer
0 Votes

Engineering has rolled back the change that caused the response element names to change.  The problem should be resolved.

Best Answer