Food Log

Food logging is often used in pair with Healthy recipe recommendations

Full API reference

External Id

To avoid duplicated records being created, Whisk supports external_id. The external id is uniquely maintained within the user. Trying to add another record with already existing external id will result in 400 Bad Request response.

External id is a an arbitrary non empty string up to 128 chars length. External Id is optional. Whisk will generate it's own food log record identifier anyway.

Food type

food_type field is used to reference the source of nutritional information for a food item. It's a one of field featuring the following options

Measure

measure field is opaque for Whisk and is used only to indicate the number of serving a person has eaten. We expect the total nutrition (not per 100g) of the food to be passed in the food log.

Source

source field is used internally to track the origin of logged food data. It may take the following values

FOOD_ITEM_SOURCE_SMART_THINGS_COOKING
FOOD_ITEM_SOURCE_SAMSUNG_HEALTH

Log a recipe

"recipe":{
	"id":"107666fe014c3794f86b18bed2c80d5a1f2"
}

Log a manual item

Manual item can either be a manual input by a user or aggregated data.

"food_type":{
      "manual_product": {}
}

Log Whish HealthDB Food

 "food": {
	"id": "string"
}

For items found via Food Search

Log recipe

curl -X POST "https://api.whisk.com/health/foodlog/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '{
  "add":{
    "items":[
      {
        "body":{
          "item":{
            "title":"my personal item",
            "nutrition":[
              {
                "amount":10,
                "unit_name":"NUTRITION_UNIT_KCAL",
                "code":"NUTRITION_CODE_FAT_UNSAT"
              }
            ],
            "measure":{
              "scale":{
                "value":5
              }
            },
            "source":"FOOD_ITEM_SOURCE_SMART_THINGS_COOKING",
            "food_type":{
              "recipe":{
                "id":"107666fe014c3794f86b18bed2c80d5a1f2"
              }
            }
          }
        },
        "external_id":"uuid-uuid-uuid-uuid",
        "meal_time":"MEAL_TIME_SNACK",
        "consumed_at":"1667912872000"
      }
    ]
  }
}'

Log manual food item

curl -X POST "https://api.whisk.com/health/foodlog/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '{
  "add":{
    "items":[
      {
        "body":{
          "item":{
            "title":"my personal item",
            "nutrition":[
              {
                "amount":10,
                "unit_name":"NUTRITION_UNIT_KCAL",
                "code":"NUTRITION_CODE_FAT_UNSAT"
              }
            ],
            "measure":{
              "scale":{
                "value":5
              }
            },
            "source":"FOOD_ITEM_SOURCE_SMART_THINGS_COOKING",
            "food_type":{
              "manual_product": {}
            }
          }
        },
        "external_id":"uuid-uuid-uuid-uuid",
        "meal_time":"MEAL_TIME_SNACK",
        "consumed_at":"1667912872000"
      }
    ]
  }
}'

Delete food items

curl -X POST "https://api.whisk.com/health/foodlog/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '{
  "delete": {
    "food_log_ids": [
      "uuid-uuid-uuid-uuid"
    ],
    "external_ids": [
      "uuid-uuid-uuid-uuid"
    ]
  }
}'

Update food items

For update operation it's sufficient to pass either Whisk generated food_log_id or external_id

mask field should also be passed indicating what fields should be updated. The supported values are

"body.item.title"
"body.item.nutrition"
"body.item.measure"
"body.item.source"
"body.item.food_type"
"meal_time"
"consumed_at"
"external_id"
curl -X POST "https://api.whisk.com/health/foodlog/v2/action" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%" -H "Content-Type: application/json" -d '{
  "update":{
    "items":[
      {
        "external_id": "uuid-uuid-uuid-uuid",
        "body": {
          "item": {
            "title": "my personal item",
            "nutrition":[
              {
                "amount":10,
                "unit_name":"NUTRITION_UNIT_KCAL",
                "code":"NUTRITION_CODE_FAT_UNSAT"
              }
            ],
            "measure":{
              "scale":{
                "value":5
              }
            }
          }
        },
        "mask": {
          "paths": [
            "body.item.title",
	    "body.item.nutrition",
	    "body.item.measure"
          ]
        }
      }
    ]
  }
}'

Get logged food

curl -X GET "https://api.whisk.com/health/foodlog/v2?period.from=1667912872000&period.to=1667912872000" -H "accept: application/json" -H "Authorization: Bearer %USER_TOKEN%"

Last updated