Whisk Docs
Whisk HomeHelp CenterDeveloper Tools
v2.0.0
v2.0.0
  • The Whisk Platform
  • Whisk API Overview
    • Introduction
    • Integration
    • Authentication
      • Server Token
      • User Access Token
        • Auth Flow Example
      • Client Token
      • Anonymous Access from Client Apps
    • Whisk Sandbox
    • Getting Started
  • Whisk API Reference 2.0
    • Provisioning
      • Get provisioning
    • Autocomplete
    • Community
      • Get your Communities
      • Get Communities from a Topic
      • Discover Recommended Communities
      • Search Communities
      • Get a Community
      • Get Recipes from a Community
      • Add Recipes to a Community
      • Remove a Recipe from a Community
      • Join a Community
      • Leave a Community
    • Posts and Reviews
      • Get reviews for a recipe
      • Create or edit review
      • Create a Post
      • Get Post by id
      • Delete a Post
      • Edit a Post
      • Report a Post
      • Create a Post Reply
      • Get Post Replies
      • Delete a Post reply
      • Report a Post reply
      • Like a Post or Reply
      • Users who liked a Post or Reply
    • Public profiles
      • Hide recipe in Public profile
      • Get Recipes for Public Profile
      • Get User's public profile by user_id
      • Get User's public profile by username
    • Custom Label
    • Feed
      • Obtain a Recipe Feed
    • Food DB
      • Autocomplete
      • Search
      • Get Food
    • Food List
    • Food Log
    • Foodpairing
    • Healthy meal recommendations
      • Healthy recipe only recommendations for DA
      • Recipe recommendations for SH
      • Tailored Plan API request for Samsung TV
    • Meal Plan
      • Generate a Meal Plan
      • Meal Object
        • Get Meals
        • Delete Meal
        • Add a Meal
      • Meal Plan Settings Object
        • Get Meal Plan Settings
        • Update Meal Plan Settings
      • Meal Plan Batch
    • Recipe
      • Get a Recipe
      • Search a Recipe
      • User Recipes & Collections
        • Add User Recipe
        • Create A Recipe
        • Update External Recipe
        • Get All User Recipes
        • Update User Recipe
        • Remove Recipe from Favorites
        • Create Collection
        • Get All User Collections
        • Get Collection
        • Get Recipes from a Collection
        • Remove Collection
        • Get Smart Collection
        • Get Recipes from a Smart Collection
    • Shopping List
      • Get your Shopping Lists
      • Get a Shopping List
      • Create a Shopping List
      • Delete a Shopping List
      • Update basic details of a Shopping List
      • Move Items between Shopping Lists
      • Add Items to a Shopping List
      • Delete an Item from a Shopping List
      • Update an Item in a Shopping List
      • Clear Items from a Shopping List
    • Media
    • Store Item
    • Unit Conversion
    • Users
      • Get a User
      • Update User Settings using Patch
      • Update User Settings using Post
    • Try it out!
  • Shopping List SDK
    • Overview
    • Examples
      • Shoppable Recipes
      • Shoppable Products
      • Shoppable Media
    • Basic Setup
      • Basic Setup
      • Methods
      • Event Listeners
      • Widget
      • Subscriptions
      • Global Configuration
      • UTM Parameters
      • Using With SPA
  • Shopping List Mobile API
    • Overview
    • Examples
    • Reference
  • API Resources
    • Authentication Scopes
    • Errors and Troubleshooting
    • Cursor Pagination
    • Limits
    • Nutrients
    • Recipe Labels
    • Filtering Recipes using Custom Labels
    • Health Score, Glycemic Index, Glycemic Load
    • Whisk User Data
    • Integrated Retailers
    • Optimizing Image Load
    • Meal Plan
Powered by GitBook
On this page
  • Log recipe
  • Log manual food item
  • Delete food items
  • Update food items

Was this helpful?

  1. Whisk API Reference 2.0

Food Log

Food logging is often used in pair with Healthy recipe recommendations

PreviousFood ListNextFoodpairing

Last updated 2 years ago

Was this helpful?

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"
}

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%"

For items found via

Full API reference
Food Search