foodGroups

List food groups

Return a keyset-paginated page of the canonical food-group catalog.

The catalog is small and stable, so a single page usually covers it. Supports filtering (id, name), sorting, sparse fieldsets (fields[food-groups]), and ?q=.

get/v1/food-groups

Request

  • Base URL: https://api.noms.sh
  • URL: https://api.noms.sh/v1/food-groups
  • Auth: API key in header X-API-Key

Query parameters

page_sizeinteger nullable

Number of items to return per page (keyset pagination). Allowed range is 1–20; a value outside it is rejected with a 400.

Example:20
cursorstring nullable

Opaque keyset-pagination cursor. Don't build it by hand; follow links.next from a previous response to fetch the next page.

sortstring nullable

Sort key; prefix with - for descending (-name). Comma-join keys for tie-breakers. Defaults to the resource's natural order.

Example:-name
qstring nullable

Typo-tolerant text search. Filters to matching rows and, when no sort is given, orders them by relevance. Composes with filters and pagination.

Example:chocolat
fields[food-groups]string

Sparse fieldset. A comma-separated subset of food-groups fields to return (e.g. id,name). Omit to return all fields.

idstring

Filter on id. Bare id=value means eq; the bracket form names the operator — id[eq], id[in]. id[in] takes a comma-separated list. Rows with no value for the field never match.

namestring

Filter on name. Bare name=value means eq; the bracket form names the operator — name[eq], name[in]. name[in] takes a comma-separated list. Rows with no value for the field never match.

Headers

If-None-Matchstring

An ETag from a previous response for this URL. If it still matches, the API answers 304 Not Modified with no body; otherwise you get the full 200. Either way the request is metered.

Response

A page of food groups. fields[food-groups] may trim the keys present in each data item.

Example response

{
  "data": [
    {
      "icon_url": "https://images.noms.sh/dairy-icon-hash",
      "id": "DAIRY",
      "name": "Dairy"
    }
  ],
  "links": {
    "next": "https://api.noms.sh/v1/foods?page_size=2&cursor=eyJ2IjpbeyJ0IjoicmF3IiwidiI6Ik1pbGsifV0sInMiOiIrbmFtZSJ9",
    "self": "https://api.noms.sh/v1/foods?page_size=2"
  },
  "meta": {
    "has_more": true,
    "page_size": 10
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.