food_entries.get

Description

Returns saved food diary entries for the user according to the filter specified. This method can be used to return all food diary entries recorded on a nominated date or a single food diary entry with a nominated food_entry_id.

The only storable values returned by this call are the food_entry_id unique food diary entry identifiers.

Parameters

Required

Name Type Description
oauth_consumer_key String Your API key when you registered as a developer
oauth_signature_method String The method used to generate the signature (only HMAC-SHA1 is supported)
oauth_timestamp Int The date and time, expressed in the number of seconds since January 1, 1970 00:00:00 GMT. The timestamp value must be a positive integer and must be equal or greater than the timestamp used in previous requests
oauth_nonce String A randomly generated string for a request that can be combined with the timestamp to produce a unique value
oauth_version String MUST be "1.0"
oauth_signature String The signature, a consistent reproducible concatenation of the request elements into a single string. The string is used as an input in hashing or signing algorithms.
method String MUST be "food_entries.get"
oauth_token String The key of the profile to use.
date Int The number of days since January 1, 1970 (default value is the current day). You must specify either date or food_entry_id.
food_entry_id Int The ID of the food entry to retrieve. You must specify either date or food_entry_id.

Optional

Name Type Description
format String The desired response format. Valid reponse formats are "xml" or "json" (default value is "xml").

Response

The food diary entry elements returned are those previously saved by the user for the filter specified. Detailed nutritional information is provided for each food diary entry as follows:

  • food_entry_id – the unique identifier of the food diary entry.
  • food_entry_description – the full description of the food entry. E.G.: "1 cup Instant Oatmeal" or "100 g Corned Beef".
  • date_int is an Int – the date of the entry, see dateint.
  • meal – the meal of the day, see meal_type.
  • food_id – the unique food identier.
  • serving_id – the unique serving identifier, indicating the serving size nominated for the food diary entry.
  • number_of_units is a Decimal - the number of units of the standard serving size consumed.
  • food_entry_name – a description of the food item as entered by the user; typically the name of the food. E.G.: "Instant Oatmeal".

The complete nutritional information is returned - see nutrient

  • calories is a Decimal – the energy content in kcal.
  • carbohydrate is a Decimal – the total carbohydrate content in grams.
  • protein is a Decimal – the protein content in grams.
  • fat is a Decimal – the total fat content in grams.
  • saturated_fat is a Decimal – the saturated fat content in grams (where available).
  • polyunsaturated_fat is a Decimal – the polyunsaturated fat content in grams (where available).
  • monounsaturated_fat is a Decimal – the monounsaturated fat content in grams (where available).
  • trans_fat is a Decimal – the trans fat content in grams (where available).
  • cholesterol is a Decimal – the cholesterol content in milligrams (where available).
  • sodium is a Decimal – the sodium content in milligrams (where available).
  • potassium is a Decimal – the potassium content in milligrams (where available).
  • fiber is a Decimal – the fiber content in grams (where available).
  • sugar is a Decimal – the sugar content in grams (where available).
  • vitamin_a is a Decimal – the percentage of daily recommended Vitamin A, based on a 2000 calorie diet (where available).
  • vitamin_c is a Decimal – the percentage of daily recommended Vitamin C, based on a 2000 calorie diet (where available).
  • calcium is a Decimal – the percentage of daily recommended Calcium, based on a 2000 calorie diet (where available).
  • iron is a Decimal – the percentage of daily recommended Iron, based on a 2000 calorie diet (where available).

Example Return XML

<?xml version="1.0" encoding="utf-8" ?>
<food_entries xmlns="http://platform.fatsecret.com/api/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://platform.fatsecret.com/api/1.0/ http://platform.fatsecret.com/api/1.0/fatsecret.xsd">
    <food_entry>
        <food_entry_id>1111111</food_entry_id>
        <food_entry_description>1 regular slice, plain french toast</food_entry_description>
        <date_int>14289</date_int>
        <meal>Breakfast</meal>
        <food_id>4384</food_id>
        <serving_id>16758</serving_id>
        <number_of_units>2.000</number_of_units>
        <food_entry_name>plain french toast</food_entry_name>
        <calories>317</calories>
        <carbohydrate>40.04</carbohydrate>
        <protein>11.17</protein>
        <fat>12.26</fat>
        <saturated_fat>3.171</saturated_fat>
        <polyunsaturated_fat>3.156</polyunsaturated_fat>
        <monounsaturated_fat>4.596</monounsaturated_fat>
        <cholesterol>179</cholesterol>
        <sodium>640</sodium>
        <potassium>160</potassium>
        <fiber>1.6</fiber>
        <sugar>9.74</sugar>
        <vitamin_a>0</vitamin_a>
        <vitamin_c>0</vitamin_c>
        <calcium>15</calcium>
        <iron>18</iron>
    </food_entry>
</food_entries>

Example Return JSON

{ "food_entries": {"food_entry": {"calcium": "15", "calories": "317", "carbohydrate": "40.04", "cholesterol": "179", "date_int": "14289", "fat": "12.26", "fiber": "1.6", "food_entry_description": "1 regular slice, plain french toast", "food_entry_id": "1111111", "food_entry_name": "plain french toast", "food_id": "4384", "iron": "18", "meal": "Breakfast", "monounsaturated_fat": "4.596", "number_of_units": "2.000", "polyunsaturated_fat": "3.156", "potassium": "160", "protein": "11.17", "saturated_fat": "3.171", "serving_id": "16758", "sodium": "640", "sugar": "9.74", "vitamin_a": "0", "vitamin_c": "0" } }}

Error Code

Code Description
2 Missing required oauth parameter: "<detail>"
3 Unsupported oauth parameter: "<detail>"
4 Invalid signature method: "<detail>"
5 Invalid consumer key: "<detail>"
6 Invalid/expired timestamp: "<detail>"
7 Invalid/used nonce: "<detail>"
8 Invalid signature: "<detail>"
9 Invalid access token: "<detail>"
FatSecret Sites
For Developers

For Professionals

For Everyone

FatSecret Platform API

Support
API

About FatSecret

© 2021 FatSecret. All rights reserved.