FatSecret Platform API Documentation
Profile - Food Diary: Get All Entries For Month
Description
Returns summary daily nutritional information for a user's food diary entries for the month specified. Use this call to display nutritional information to users about their food intake for a nominated month. Days with no food diary entries are not included.
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/month/v1" HTTP "GET" |
OR | |||
method | String | Required | "food_entries.get_month.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) |
format | String | Optional | The desired response format. Valid response formats are "xml" or "json" (default value is "xml"). |
Response
Each month
element contains information as follows:
NAME | TYPE | DESCRIPTION |
---|---|---|
from_date_int | Int | First day expressed as the number of days elapsed since January 1, 1970 |
to_date_int | Int | Last day expressed as the number of days elapsed since January 1, 1970 |
Each day
element contains information as follows:
NAME | TYPE | DESCRIPTION |
---|---|---|
date_int | Int | Date expressed as the number of days elapsed since January 1, 1970 |
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 |
Example Response
Example 1:
<?xml version="1.0" encoding="utf-8"?>
<month 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">
<from_date_int>14276</from_date_int>
<to_date_int>14303</to_date_int>
<day>
<date_int>14276</date_int>
<calories>1817</calories>
<carbohydrate>171.70</carbohydrate>
<protein>100.43</protein>
<fat>79.56</fat>
</day>
<day>
<date_int>14282</date_int>
<calories>2432</calories>
<carbohydrate>249.17</carbohydrate>
<protein>116.13</protein>
<fat>109.94</fat>
</day>
<day>
<date_int>14288</date_int>
<calories>1223</calories>
<carbohydrate>138.52</carbohydrate>
<protein>68.60</protein>
<fat>44.06</fat>
</day>
<day>
<date_int>14294</date_int>
<calories>2227</calories>
<carbohydrate>148.18</carbohydrate>
<protein>93.38</protein>
<fat>141.80</fat>
</day>
<day>
<date_int>14303</date_int>
<calories>2347</calories>
<carbohydrate>262.25</carbohydrate>
<protein>83.89</protein>
<fat>118.36</fat>
</day>
</month>
Example 1:
{
"month": {
"day": [
{
"calories": "1817",
"carbohydrate": "171.70",
"date_int": "14276",
"fat": "79.56",
"protein": "100.43"
},
{
"calories": "2432",
"carbohydrate": "249.17",
"date_int": "14282",
"fat": "109.94",
"protein": "116.13"
},
{
"calories": "1223",
"carbohydrate": "138.52",
"date_int": "14288",
"fat": "44.06",
"protein": "68.60"
},
{
"calories": "2227",
"carbohydrate": "148.18",
"date_int": "14294",
"fat": "141.80",
"protein": "93.38"
},
{
"calories": "2347",
"carbohydrate": "262.25",
"date_int": "14303",
"fat": "118.36",
"protein": "83.89"
}
],
"from_date_int": "14276",
"to_date_int": "14303"
}
}
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>' |