Skip to content
Skip to Content
Docs
Studio

Update Recipe Allergens

Records a person's answers for allergen rows and their cross-contact (may contain) list in one change, and returns the updated record. rows answers only the rows it names (contains with species where the list requires one, not_present, or not_answered to clear an answer). cross_contact, when sent, replaces the person's list; left out, the stored list is kept. Send at least one of them.

The answers and the list are checked together as the state the change leaves, so an allergen can move from contains to the cross-contact list while another moves the other way. An allergen cannot be both contains and on the list, a row an ingredient declares contains cannot be answered not_present, and species rules apply. Saves one new version, or nothing when nothing changes, and is saved whole or not at all. Send the recipe's current version_id in the If-Match header. A change makes an earlier confirmation of the record stale.

PATCH
/studio/recipes/{recipe_id}/allergens

Path Parameters

recipe_id*Recipe Id

Header Parameters

If-Match*string

The recipe's current version_id: the one the last change to this recipe returned, or the one reading the recipe returns (get_recipe). A stale value is refused with the current version_id; read the recipe again and retry.

Request Body

application/json
  1. body

Row answers and the cross-contact list, saved together.

rows?array<>

Answers for the rows to change, each naming a different code. Rows left out keep their answers.

Itemsitems <= 32
cross_contact?array<>|

The person's whole cross-contact list, replacing the one stored. Send it only when the list changes: left out or null, the stored list is kept, and an empty list clears it. Ingredients' cross-contact declarations still count.

Response Body

Successful Response

application/json
  1. response

The envelope for reading and changing a recipe's allergen record.

data*

The allergen record of one recipe version.

meta*

Response metadata.

version_id?|

The version the record was read at; pass it as If-Match on the next change. Null only for a recipe that was never versioned.

Example Request
curl -X PATCH 'https://api.bettermenu.live/studio/recipes/string/allergens' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "data": {    "country": "US",    "list_version": "string",    "rows": [      {        "code": "string",        "state": "contains",        "species": [          "string"        ],        "other_species": [          "string"        ],        "sources": [          {            "kind": "custom_ingredient",            "ingredient_row_id": "string",            "custom_ingredient_id": "string",            "custom_ingredient_version_id": "string",            "name": "string",            "via": [              "string"            ],            "actor": {              "type": "member",              "id": "string"            },            "channel": "studio",            "at": "2019-08-24T14:15:22Z"          }        ],        "carried_state": "contains",        "carried_species": [          "string"        ],        "carried_other_species": [          "string"        ],        "person": {          "state": "contains",          "species": [            "string"          ],          "other_species": [            "string"          ],          "actor": {            "type": "member",            "id": "string"          },          "channel": "studio",          "at": "2019-08-24T14:15:22Z"        },        "person_answer_superseded": false,        "name": "string",        "contributors": [          {            "ingredient_row_id": "string",            "name": "string",            "kind": "custom",            "custom_ingredient_id": "string",            "custom_ingredient_version_id": "string",            "declared": "contains",            "species": [              "string"            ],            "other_species": [              "string"            ],            "cross_contact": false          }        ]      }    ],    "cross_contact": [      {        "code": "string",        "sources": [          {            "kind": "custom_ingredient",            "ingredient_row_id": "string",            "custom_ingredient_id": "string",            "custom_ingredient_version_id": "string",            "name": "string",            "via": [              "string"            ],            "actor": {              "type": "member",              "id": "string"            },            "channel": "studio",            "at": "2019-08-24T14:15:22Z"          }        ]      }    ],    "unanswered": [      "string"    ],    "unreadable_ingredient_rows": [      "string"    ],    "complete": true,    "record_hash": "string",    "confirmation": {      "state": "confirmed",      "current": {        "confirmation_id": "string",        "version_id": "string",        "record_hash": "string",        "actor": {          "type": "member",          "id": "string"        },        "channel": "studio",        "confirmed_at": "2019-08-24T14:15:22Z"      }    },    "label_lines": {      "contains_line": "string",      "may_contain_line": "string",      "printable": true,      "contains_printable": true,      "may_contain_printable": true,      "problem": {        "reason": "unconfirmed",        "codes": [          "string"        ],        "lines": [          "contains"        ]      },      "problems": [        {          "reason": "unconfirmed",          "codes": [            "string"          ],          "lines": [            "contains"          ]        }      ]    }  },  "meta": {    "version": "string",    "request_id": "string",    "timestamp": "string"  },  "version_id": "string"}

Recipe in, FDA-format Nutrition Facts out, with every version kept.

Start freeNo card needed.