FatSecret Platform API Documentation

Profile - Foods: Create

OAuth 1.0 Deprecated Premier Exclusive
Description

Creates a food for the user according to the parameters specified. The result of the call is the new unique identifier of the newly created food.

Parameters
URL / Method
NAME TYPE REQUIRED DESCRIPTION
URL (new)
Method
N/A Required "https://platform.fatsecret.com/rest/food/v1"
HTTP "POST"
OR
method String Required "food.create" (included with other parameters)
Additional Parameters
NAME TYPE REQUIRED DESCRIPTION
brand_type String Required Either "manufacturer", "restaurant" or "supermarket" (default value is "manufacturer")
brand_name String Required Brand name, only when food_type is "Brand". E.G.: "Quaker"
food_name String Required Name of the food, not including the brand name. E.G.: "Instant Oatmeal"
serving_size String Required Full description of the serving size. E.G.: "1 serving"
calories Decimal Required Energy content in kcal
fat Decimal Required Total fat content in grams
carbohydrate Decimal Required Total carbohydrate content in grams
protein Decimal Required Protein content in grams
serving_amount String Optional The quantity combined with serving_amount_unit to derive the total standardized quantity of the serving
serving_amount_unit String Optional The metric unit of measure for the serving size – either "g" or "ml" or "oz" – combined with metric_serving_amount to derive the total standardized quantity of the serving (default value is "g")
calories_from_fat Decimal Optional The energy content in kcal from fat
saturated_fat Decimal Optional Saturated fat content in grams (where available)
polyunsaturated_fat Decimal Optional Polyunsaturated fat content in grams (where available)
monounsaturated_fat Decimal Optional Monounsaturated fat content in grams (where available)
trans_fat Decimal Optional Trans fat content in grams (where available)
cholesterol Decimal Optional Cholesterol content in milligrams (where available)
sodium Decimal Optional Sodium content in milligrams (where available)
potassium Decimal Optional Potassium content in milligrams (where available)
fiber Decimal Optional Fiber content in grams (where available)
sugar Decimal Optional Sugar content in grams (where available)
other_carbohydrate Decimal Optional The other carbohydrate content in grams
vitamin_a Decimal Optional Percentage of daily recommended Vitamin A, based on a 2000 calorie diet (where available)
vitamin_c Decimal Optional Percentage of daily recommended Vitamin C, based on a 2000 calorie diet (where available)
calcium Decimal Optional Percentage of daily recommended Calcium, based on a 2000 calorie diet (where available)
iron Decimal Optional Percentage of daily recommended Iron, based on a 2000 calorie diet (where available)
region String Optional Results will be filtered by region. E.G.: "FR" returns results from France
language String Optional (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
format String Optional The desired response format. Valid response formats are "xml" or "json" (default value is "xml").
Response
The only storable value returned by this call is food_id.

Each food_id element contains information as follows:

NAME TYPE DESCRIPTION
food_id Long Unique food identifier

Example Response

Example 1:

<?xml version="1.0" encoding="utf-8" ?>
<food_id xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://platform.fatsecret.com/api/1.0/"
         xsi:schemaLocation="http://platform.fatsecret.com/api/1.0/ http://platform.fatsecret.com/api/1.0/fatsecret.xsd">
    1111111
</food_id>

Example 1:

{
  "food_id": {
    "value": "1111111"
  }
}
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>'
101 Parameter Missing required parameter: '<details>'
108 Parameter Invalid Type: '<details>'