Food Search

This resource provides a way to search the available Foods.

Note: The catalog of available Foods can vary by API key.

Resource URI

/foods

Resource Parameters

This resource supports the following parameters:

NameDefaultRequiredDescription
query yes A query
count 25 no The number of results to return
start 0 no The (0-based) index of the first result to return
spell true no If true and no results are found for the specified query, apply spelling correction and re-query

Resource Properties

This resource is represented as an object with the following fields:

NameTypeDescription
query string The search query
total number The total number of results
first_page string The URL of the first page of results
next_page string The URL of the next page of results
prev_page string The URL of the previous page of results
items array of Food Results The current page of results

Food Result Properties

A Food Result is represented as an object with the following fields:

NameTypeDescription
id string The unique identifier of the Food
description string A human-readable description of the Food
group string A human-readable description of the Food's group
product string A human-readable description of the Food's product
supplier string A human-readable description of the Food's supplier
quantity number The default quantity of the Food
unit string The unique identifier of the Food's default unit
units array of string The unique identifier(s) of the unit available for the Food
modified string The date (in ISO 8601 format) that the Food was last updated

The above result fields are a significant subset of those available when loading a Food directly.

Supported Operations

Search Foods (HTTP GET)

HTTP GET returns a JSON document containing paginated search results.

Example Request

GET /foods?apikey=d9eea4cc28c342a2a7fc49d307860c03&query=broccoli
Accept: application/json

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "query": "broccoli",
  "total": 188,
  "first_page": "\/foods?query=broccoli",
  "next_page": "\/foods?query=broccoli&start=25",
  "items": [
    {
      "id": "urn:uuid:17dbb668-f3f4-4822-8566-f46496887edc",
      "description": "Broccoli, fresh",
      "group": "Fresh Vegetables & Legumes",
      "quantity": 0.5,
      "supplier": "USDA SR-24",
      "unit": "urn:uuid:dfad1d25-17ff-4201-bba0-0711e8b88c65",
      "units": [
        "urn:uuid:dfad1d25-17ff-4201-bba0-0711e8b88c65",
        "urn:uuid:c2a18c35-f4e7-4297-b8de-1e0f1bd16cfb",
        "urn:uuid:1c8d43b3-6b19-43ab-95f0-803a37fdf4f1",
        ...
      ],
      "modified": "2011-10-04"
    },
    ...
  ]
}