Food Log Entries
The foodLogs
query retrieves a comprehensive list of food log entries for the authenticated user within a specified date range. This query allows access to data for all food categories.
Available Arguments
Argument
Type
Required?
Description
Start
Date
True
Starting filter date range, format YYYY-mm-dd
End
Date
True
Ending filter date range, format YYYY-mm-dd
Id
String
False
ID
of the logged food. Add this parameter to get the specific information of a logged food.
Available Fields
Field
Type
Note
name
String
Name of the logged item
date
Date
Date of the log entry
mealType
MealType
Type of meal that was logged. RECIPE, MENU_ITEM
servings
Object that contains predefined serving types and sizes
serving
Float
quantity
Float
Quantity of logged servings
servingWeight
Float
Weight in grams of each serving
food
Food
union Food = BrandedFoodNodeProxy
, CommonFoodNodeProxy
, MealProxy
, MyBrandedFoodProxy
, MyCommonFoodProxy
, RecipeProxy
, UserRecipeProxy
.
Pagination
The foodLogs
query supports the use of pagination. The following fields can be used
cursor
}
pageInfo {
endCursor
hasNextPage
}
Refer to the pagination documentation for more information.
Examples
GraphQL Examples
Get the meals logged on specific dates
The following example retrieves the meals logged between to given dates:
{
foodLogs(start: "2021-09-01", end: "2021-10-05"){
edges {
node
{
foodId
portionModifier
date
grams
mealTime
}
}
}
}
{
"data": {
"foodLogs": {
"edges": [
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-01",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-01",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-01",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "Q29tbW9uRm9vZE5vZGU6MTczNDQ0",
"portionModifier": null,
"date": "2021-10-02",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-02",
"grams": 2,
"mealTime": "DINNER"
}
}
]
}
}
}
curl Example
curl -XPOST 'https://production.suggestic.com/graphql' \
-H 'Authorization: Bearer <User-JWT>' \
-H 'Content-Type: application/json' \
--data-raw '{"query": "{foodLogs(start:\"2021-09-01\", end:\"2021-10-05\"){edges{ node { id date mealTime foodId grams servings}} }}"}'
GraphQL Example
query($first: Int, $start: Date! $end: Date!) {
foodLogs(first: $first, start: $start, end: $end){
edges {
cursor
node {
id
date
mealTime
foodId
grams
servings
time
portionModifier
}
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
{
"data": {
"foodLogs": {
"edges": [
{
"node": {
"foodId": "Q29tbW9uRm9vZE5vZGU6MTczNDQ0",
"portionModifier": null,
"date": "2021-09-02",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-01",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-01",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-01",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "Q29tbW9uRm9vZE5vZGU6MTczNDQ0",
"portionModifier": null,
"date": "2021-10-02",
"grams": 2,
"mealTime": "DINNER"
}
},
{
"node": {
"foodId": "QnJhbmRlZEZvb2ROb2RlOjQ3OTk0MQ==",
"portionModifier": null,
"date": "2021-10-02",
"grams": 2,
"mealTime": "DINNER"
}
}
]
}
}
}
GraphQL Example with nutrients and all food data types
query($start: Date! $end: Date!) {
foodLogs(start: $start, end: $end){
edges {
cursor
node {
id
date
mealTime
foodId
grams
servings
time
portionModifier
food {
... on BrandedFoodNodeProxy {
brandedFood {
brandName
brandOwner
dataType
description
foodDataId
householdServingFulltext
name
nutrients {
amount
name
type
unit
}
servingSize
servingSizeUnit
}
}
... on CommonFoodNodeProxy {
commonFood {
dataType
description
foodDataId
name
nutrients {
amount
name
type
unit
}
portions {
amount
gramWeight
modifier
seqNum
}
}
}
... on MealProxy {
meal {
id
meal
numOfServings
recipe {
id
databaseId
name
numberOfServings
nutritionalInfo {
calcium
calories
carbs
cholesterol
fat
fiber
iron
potassium
protein
saturatedFat
sodium
sugar
transFat
vitaminD
}
serving
servingWeight
}
}
}
... on MyBrandedFoodProxy {
myBrandedFood {
brandName
brandOwner
dataType
description
foodDataId
householdServingFulltext
name
nutrients {
amount
name
type
unit
}
servingSize
servingSizeUnit
}
}
... on RecipeProxy {
recipe {
databaseId
name
numberOfServings
nutritionalInfo {
calcium
calories
carbs
cholesterol
fat
fiber
iron
potassium
protein
saturatedFat
sodium
sugar
transFat
vitaminD
}
serving
servings {
amount
description
equivalent
unit
}
servingWeight
}
}
... on UserRecipeProxy {
userRecipe {
name
nutrientsPerServing {
amount
name
type
unit
}
servingWeight
text
}
}
}
}
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
{
"data": {
"foodLogs": {
"edges": [
{
"cursor": "T2Zmc2V0OjE=",
"node": {
"id": "Rm9vZExvZzo5ODEwMQ==",
"date": "2023-01-12",
"mealTime": "DINNER",
"foodId": "QnJhbmRlZEZvb2ROb2RlOjFhMDFlMzI5LTc3ZjQtNDgzYy1hNzg4LTZkOTNlYWE1MjMzMQ==",
"grams": 100,
"servings": 2,
"time": null,
"portionModifier": "halfs",
"food": {
"brandedFood": {
"brandName": null,
"brandOwner": "OREOS",
"dataType": "branded_food",
"description": "OREOS, CHOCOLATE COVERED",
"foodDataId": "504036",
"householdServingFulltext": "1 PIECE",
"name": "Chocolate covered oreos",
"nutrients": [
{
"amount": 0,
"name": "Calcium, Ca",
"type": "CALCIUM_CA",
"unit": "MG"
},
{
"amount": 6.43,
"name": "Iron, Fe",
"type": "IRON_FE",
"unit": "MG"
},
{
"amount": 0,
"name": "Vitamin A, IU",
"type": "VITAMIN_A_IU",
"unit": "IU"
},
{
"amount": 0,
"name": "Vitamin C, total ascorbic acid",
"type": "VITAMIN_C_TOTAL_ASCORBIC_ACID",
"unit": "MG"
},
{
"amount": 0,
"name": "Cholesterol",
"type": "CHOLESTEROL",
"unit": "MG"
},
{
"amount": 0,
"name": "Protein",
"type": "PROTEIN",
"unit": "G"
},
{
"amount": 25,
"name": "Total lipid (fat)",
"type": "FAT",
"unit": "G"
},
{
"amount": 71.43,
"name": "Carbohydrate, by difference",
"type": "CARBS",
"unit": "G"
},
{
"amount": 500,
"name": "Energy",
"type": "ENERGY",
"unit": "KCAL"
},
{
"amount": 53.57,
"name": "Sugars, total including NLEA",
"type": "SUGARS_TOTAL_INCLUDING_NLEA",
"unit": "G"
},
{
"amount": 3.6,
"name": "Fiber, total dietary",
"type": "FIBER_TOTAL_DIETARY",
"unit": "G"
},
{
"amount": 232,
"name": "Sodium, Na",
"type": "SODIUM_NA",
"unit": "MG"
},
{
"amount": 0,
"name": "Fatty acids, total trans",
"type": "FATTY_ACIDS_TOTAL_TRANS",
"unit": "G"
},
{
"amount": 12.5,
"name": "Fatty acids, total saturated",
"type": "FATTY_ACIDS_TOTAL_SATURATED",
"unit": "G"
}
],
"servingSize": 28,
"servingSizeUnit": "g"
}
}
}
}
],
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "T2Zmc2V0OjA=",
"endCursor": "T2Zmc2V0OjE="
}
}
}
}
Last updated