FatSecret Platform API Documentation
Profile - Food Diary: Get All Entries
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.
Why are we introducing this version?
Parameters
URL / Method
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
URL (new) Method |
N/A | Required | "https://platform.fatsecret.com/restfood-entries/v2" HTTP "GET" |
OR | |||
method | String | Required | "food_entries.get.v2" (included with other parameters) |
Additional Parameters
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
date | Int | Required | Number of days since January 1, 1970 (default value is the current day) |
food_entry_id | Long | Required | Unique identifier of the food diary entry |
format | String | Optional | The desired response format. Valid response formats are "xml" or "json" (default value is "xml"). |
Response
food_entry_id, food_id, serving_id
. Each food_entry
element contains information as follows:
NAME | TYPE | DESCRIPTION |
---|---|---|
food_entry_id | Long | Unique identifier of the food diary entry |
food_entry_description | String | Full description of the food entry. E.G.: "1 cup Instant Oatmeal" or "100 g Corned Beef" |
date_int | Int | Date expressed as the number of days elapsed since January 1, 1970 |
meal | String | Type of meal eaten. Valid meal types are "breakfast", "lunch", "dinner" and "other" |
food_id | Long | Unique food identifier |
serving_id | Long | Unique serving identifier |
number_of_units | Decimal | Number of units in this standard serving size. For instance, if the serving description is "2 tablespoons" the number of units is "2", while if the serving size is "1 cup" the number of units is "1". Please note that this is only applicable for when food_type is "Generic" whereas for "Brand" the number of units will always be "1" |
food_entry_name | String | A description of the food item as entered by the user; typically the name of the food. E.G.: "Instant Oatmeal" |
calories | Decimal | Energy content in kcal |
carbohydrate | Decimal | Total carbohydrate content in grams |
protein | Decimal | Protein content in grams |
fat | Decimal | Total fat content in grams |
saturated_fat | Decimal | Saturated fat content in grams (where available) |
polyunsaturated_fat | Decimal | Polyunsaturated fat content in grams (where available) |
monounsaturated_fat | Decimal | Monounsaturated fat content in grams (where available) |
cholesterol | Decimal | Cholesterol content in milligrams (where available) |
sodium | Decimal | Sodium content in milligrams (where available) |
potassium | Decimal | Potassium content in milligrams (where available) |
fiber | Decimal | Fiber content in grams (where available) |
sugar | Decimal | Sugar content in grams (where available) |
vitamin_a | Decimal | Vitamin A content in micrograms (where available) |
vitamin_c | Decimal | Vitamin C content in milligrams (where available) |
calcium | Decimal | Calcium content in milligrams (where available) |
iron | Decimal | Iron content in milligrams (where available) |
Example Response
Example 1:
<?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 1:
{
"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 Codes
CODE | TYPE | DESCRIPTION |
---|---|---|
2 | OAuth 1.0 | Missing required oauth parameter: '<details>' |
3 | OAuth 1.0 | Unsupported oauth parameter: '<details>' |
4 | OAuth 1.0 | Invalid signature method: '<details>' |
5 | OAuth 1.0 | Invalid consumer key: '<details>' |
6 | OAuth 1.0 | Invalid/expired timestamp: '<details>' |
7 | OAuth 1.0 | Invalid/used nonce: '<details>' |
8 | OAuth 1.0 | Invalid signature: '<details>' |
9 | OAuth 1.0 | Invalid access token: '<details>' |