food_entries.get_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.

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_month"
oauth_token String The key of the profile to use.

Optional

Name Type Description
format String The desired response format. Valid reponse formats are "xml" or "json" (default value is "xml").
date Int The number of days since January 1, 1970 (default value is the current day).

Response

The day elements returned are those where one or more food diary entries have been recorded for the specified month. Days with no food diary entries are not included.

The general information returned is:

  • from_date_int is an Int – the first day in the nominated month, see dateint.
  • to_date_int is an Int – the last day in the nominated month, see dateint.

Each day element contains summary nutritional information for a single day as follows:


Example Return XML

<?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 Return JSON

{ "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 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

© 2022 FatSecret. All rights reserved.