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

Created food by FoodName but no nutrition shows in the app? Help please. Docs not clear.

The documentation in this section https://dev.fitbit.com/build/reference/web-api/food-logging/#logging-and-deleting-collection-data is not clear on how to log the nutrition for a food using the foodName (second method). 

 

It says " you should also explicitly provide the calories and optionally brandName (or source name) and a full set of nutritional values for this log entry".     I have tried sending the following data.

 

{'foodName': 'pilchard sandwich', 'date': '2019-10-25', 'amount': 1, 'unitId': 168, 'mealTypeId': 3, 'favorite': false, 'fat': 21.57, 'carbohydrate': 53.25, 'fiber': 3.22, 'alcohol': 0.0, 'protein': 46.07, 'saturated_fat': 8.31, 'sugar': 12.54, 'calories': 589}

 

The food was created, and calories registered. But nutrition information was not recorded. The response from the API was successful (201) but as follows,


{"foodDay":{"date":"2019-10-25","summary":{"calories":4237,"carbs":103.11,"fat":39,"fiber":10.32,"protein":229.07,"sodium":1637.87,"water":1182.94}},"foodLog":{"isFavorite":false,"logDate":"2019-10-25","logId":196063097,"loggedFood":{"accessLevel":"PRIVATE","amount":1,"brand":"","calories":589,"foodId":0,"mealTypeId":3,"name":"pilchard sandwich","unit":{"id":168,"name":"item","plural":"items"},"units":[168]},"nutritionalValues":{"calories":589,"carbs":0,"fat":0,"fiber":0,"protein":46.07,"sodium":0}}}'

 

What format should the post data be for the nutrition info (other than calories) to be stored too ? 

 

Thank you, 

Best Answer
0 Votes
1 REPLY 1

Hi @gypsy_ranger 

 

I agree the documentation could be better in this area.  Would you please provide the endpoint syntax you used to log this food entry?

 

Thanks!

Gordon

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