Add a Food Log Entry

Add a food log entry

Use the addFoodLog mutation to create a new log entry for the logged-in user. It is possible to log the same food, on the same day by using a different time.

Available Arguments

Argument

Required?

Type

Description

FoodID

True

String

The FoodID retrieved from the brandedFoods or customFoods search queries

mealTime

True

Available options are BREAKFAST, SNACK, LUNCH and DINNER

date

True

Date

Date when the food is logged. Use the format YYYY-mm-dd

time

False

Time

Time when the food is logged.

servings

False

Float

Number of servings

grams

False

String

Food quantity expressed in grams

miligrams

False

String

Food quantity expressed in milligrams

portionModifier

False

String

Name of the portion consumed.

Examples

GrapqhQL Example using grams as portion

mutation {
  addFoodLog (date:"2021-10-02", 
  foodId: "Q29tbW9uRm9vZE5vZGU6MTczNDQ0", 
  mealTime:DINNER,
  servings:2,
  grams:20)
    {
      success
      message
    }
  }

GrapqhQL Example using portionModifier

mutation {
  addFoodLog (date:"2023-01-12", 
  foodId: "QnJhbmRlZEZvb2ROb2RlOjFhMDFlMzI5LTc3ZjQtNDgzYy1hNzg4LTZkOTNlYWE1MjMzMQ==", 
  mealTime:SNACK,
  servings:2,
  portionModifier: "1 PIECE")
    {
      success
      message
    }
  }

curl Example

curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"mutation { addFoodLog(foodId:\"QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==\", date:\"2021-10-02\", mealTime:DINNER, servings:2, grams:2) { success message } }"}'

Last updated