fatsecret Platform API Documentation

Recipes: Search

OAuth 2.0 OAuth 1.0 Deprecated
Description

Conducts a search of the recipe database using the search expression specified. The results are paginated according to a zero-based "page" offset. Successive pages of results may be retrieved by specifying a starting page offset value. For instance, specifying a max_results of 10 and page_number of 4 will return results numbered 41-50.

An interactive demonstration of our Recipe Search API can be accessed here

Parameters
URL / Method
NAME TYPE REQUIRED DESCRIPTION
URL (new)
Method
N/A Required "https://platform.fatsecret.com/rest/recipes/search/v1"
HTTP "GET"
OR
method String Required "recipes.search" (included with other parameters)
Additional Parameters
NAME TYPE REQUIRED DESCRIPTION
search_expression String Optional Search expression to match on food names
recipe_type String Optional Recipe type E.G.: "Appetizer"
page_number Int Optional Zero-based offset into the results for the query
max_results Int Optional Maximum number of results to return (default value is 20). This number cannot be greater than 50
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 recipe_id.

Each recipe element contains information as follows:

NAME TYPE DESCRIPTION
recipe_id Long Unique recipe identifier
recipe_name String Name of the recipe
recipe_url String URL of this recipe item on www.fatsecret.com
recipe_description String A short description of the recipe
recipe_image String URL of this image on www.fatsecret.com

Each recipe_nutrition element contains information as follows:

NAME TYPE DESCRIPTION
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"?>
<recipes 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">
  <recipe>
    <recipe_id>91</recipe_id>
    <recipe_name>Baked Lemon Snapper</recipe_name>
    <recipe_url>http://www.fatsecret.com/recipes/baked-lemon-snapper/Default.aspx</recipe_url>
    <recipe_description>Healthy fish with a tasty sauce.</recipe_description>
    <recipe_image>http://www.fatsecret.com/static/recipe/bf0c5912-9cf8-4e7a-b07a-6703c4b77082.jpg</recipe_image>
    <recipe_nutrition>
      <calories>177</calories>
      <carbohydrate>2.23</carbohydrate>
      <protein>35.1</protein>
      <fat>2.32</fat>
    </recipe_nutrition>
  </recipe>
</recipes>

Example 1:

{
  "recipes": {
    "recipe": {
      "recipe_description": "Healthy fish with a tasty sauce.",
      "recipe_id": "91",
      "recipe_image": "http://www.fatsecret.com/static/recipe/bf0c5912-9cf8-4e7a-b07a-6703c4b77082.jpg",
      "recipe_name": "Baked Lemon Snapper",
      "recipe_nutrition": {
        "calories": "177",
        "carbohydrate": "2.23",
        "fat": "2.32",
        "protein": "35.1"
      },
      "recipe_url": "http://www.fatsecret.com/recipes/baked-lemon-snapper/Default.aspx"
    }
  }
}
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>'
13 OAuth 2.0 Invalid token: '<details>'
14 OAuth 2.0 Missing scope: '<details>'
107 Parameter Value out of range: '<details>'
108 Parameter Invalid Type: '<details>'