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

App does not display meta data of food logs correctly

Hi @AndrewFitbit,

 

I have been trying to log food using the food log API with the foodName parameter. I am having issues with how this custom log appears on my Fitbit iOS app.

 

Here is my request:

 

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.fitbit.com/1/user/<user-id>/foods/log.json",
  "method": "POST",
  "headers": {
    "authorization": "Bearer <token>",
    "content-type": "application/x-www-form-urlencoded",
    "cache-control": "no-cache",
    "postman-token": "<token>"
  },
  "data": {
    "date": "2019-08-26",
    "foodName": "Potato Chips",
    "mealTypeId": "4",
    "unitId": "70",
    "amount": "3.5",
    "favorite": "false",
    "brandName": "Lay's",
    "calories": "60",
    "biotin": "0",
    "calcium": "0",
    "caloriesFromFat": "52",
    "cholesterol": "15",
    "copper": "0",
    "dietaryFiber": "0",
    "folicAcid": "0",
    "iodine": "0",
    "iron": "0",
    "magnesium": "0",
    "niacin": "0",
    "pantothenicAcid": "0",
    "phosphorus": "0",
    "potassium": "0",
    "protein": "1",
    "riboflavin": "0",
    "saturatedFat": "3.5",
    "sodium": "150",
    "sugars": "1",
    "thiamin": "0",
    "totalCarbohydrate": "1",
    "totalFat": "6",
    "transFat": "0",
    "vitaminA": "300",
    "vitaminB12": "0",
    "vitaminB6": "0",
    "vitaminC": "0",
    "vitaminD": "0",
    "vitaminE": "0",
    "zinc": "0"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

I get a perfectly normal response which is:

{
    "foodDay": {
        "date": "2019-08-26",
        "summary": {
            "calories": 280,
            "carbs": 12,
            "fat": 24,
            "fiber": 2,
            "protein": 5,
            "sodium": 495,
            "water": 0
        }
    },
    "foodLog": {
        "isFavorite": false,
        "logDate": "2019-08-26",
        "logId": 18990262XXX,
        "loggedFood": {
            "accessLevel": "PRIVATE",
            "amount": 3.5,
            "brand": "Lay's",
            "calories": 60,
            "foodId": 0,
            "mealTypeId": 4,
            "name": "Potato Chips",
            "unit": {
                "id": 70,
                "name": "cookie",
                "plural": "cookies"
            },
            "units": [
                70
            ]
        },
        "nutritionalValues": {
            "calories": 60,
            "carbs": 1,
            "fat": 6,
            "fiber": 0,
            "protein": 1,
            "sodium": 150
        }
    }
}

However, when I check the log on my phone (iOS 12.4, iPhone 8), I cannot see the foodName, brandName, or any of the nutritional information in the app, while it seems like it has been logged correctly in the request above. Here's a screenshot:IMG_2E2596F42A87-1.jpeg

 

Could you please tell me what I am missing?

 

Thank you.

Best Answer
0 Votes
2 REPLIES 2

Hi @cadenza_97 

 

Are you able to see your food log through your web browser at fitbit.com?   

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

Hi @GordonFitbit

 

I can see the log with name and brand on Fitbit.com:

Screen Shot 2019-08-29 at 3.01.57 PM.png

I cannot click on food logged using the foodName API and have it open the Nutritional Information though. I was able to do that in the app, but the opened dialog box I attached in my previous post did not show necessary information.

 

Still not sure if I'm missing something with the API.

Best Answer
0 Votes