fatsecret Platform API Documentation

Profile - Foods: Get All Favorites

OAuth 1.0 Latest
Description

Returns the favorite foods for the specified user.

Why are we introducing this version?
Updated json array formatting so it is consistent when one object is returned.
Parameters
URL / Method
NAME TYPE REQUIRED DESCRIPTION
URL (new)
Method
N/A Required "https://platform.fatsecret.com/rest/food/favorites/v2"
HTTP "GET"
OR
method String Required "foods.get_favorites.v2" (included with other parameters)
Response
The only storable values returned by this call are food_id and serving_id.

Each food element contains information as follows:

NAME TYPE DESCRIPTION
food_id Long Unique food identifier
food_name String Name of the food, not including the brand name. E.G.: "Instant Oatmeal"
food_type String Takes the value "Brand" or "Generic". Indicates whether the food is a brand or generic item
food_url String URL of this food item on www.fatsecret.com
food_description String A summary description of key nutritional values for a nominated serving size
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"

Example Response

Example 1:

<?xml version="1.0" encoding="utf-8"?>
<foods 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>
    <food_id>4384</food_id>
    <food_name>Plain French Toast</food_name>
    <food_type>Generic</food_type>
    <food_url>http://www.fatsecret.com/calories-nutrition/generic/french-toast-plain?portionid=16758&amp;portionamount=2.000</food_url>
    <food_description>Per 2 regular slices - Calories: 317kcal | Fat: 12.26g | Carbs: 40.04g | Protein: 11.17g</food_description>
    <serving_id>16758</serving_id>
    <number_of_units>2.000</number_of_units>
  </food>
</foods>

Example 1:

{
  "foods": {
    "food": [
      {
        "food_description": "Per 2 regular slices - Calories: 317kcal | Fat: 12.26g | Carbs: 40.04g | Protein: 11.17g",
        "food_id": "4384",
        "food_name": "Plain French Toast",
        "food_type": "Generic",
        "food_url": "http://www.fatsecret.com/calories-nutrition/generic/french-toast-plain?portionid=16758&portionamount=2.000",
        "number_of_units": "2.000",
        "serving_id": "16758"
      }
    ]
  }
}
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>'