Skip to main content

Includes

Some list and retrieve resources allow an includes query parameter to include additional objects relating to the fetched items. This is useful to reduce the amount of data fetched in requests to only the information needed and will not be included unless specified.

These will be marked as includes in the relevant resource section.

Sample request without includes

Request

curl --request GET \
--url 'https://myfood24.org/api/1.0/food_items?search=cornflakes&offset=0&limit=1' \
--header 'Authorization: Api-Key API-KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

Response

{
"id":123505,
"description":"Cornflakes",
"food_brand":"Non brand (generic)",
"food_category":"Breakfast Cereals",
"food_sub_category":"Cereals",
"is_generic_item":true,
"dry_multiplier":1
}

Sample request with includes

Request

curl --request GET \
--url 'https://myfood24.org/api/1.0/food_items?search=cornflakes&offset=0&limit=1&includes=portions,food_accompaniments' \
--header 'Authorization: Api-Key API-KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

Response

{
"id":123505,
"description":"Cornflakes",
"food_brand":"Non brand (generic)",
"food_category":"Breakfast Cereals",
"food_sub_category":"Cereals",
"is_generic_item":true,
"dry_multiplier":1,
"portions":[
{
"unit":"grams",
"image":"https://myfood24.org/api/1.0/food_portion_images/14676118",
"image_thumbnail":"https://myfood24.org/api/1.0/food_portion_images/14676118/thumbnail",
"size":24.0,
"description":"tablespoon, dry"
}
],
"food_accompaniments":[
{
"id":123757,
"description":"Skimmed milk"
}
]
}