Skip to content
Skip to Content
Docs
Studio

Confirm Custom Ingredient Pending Changes

Confirm a custom ingredient's open pending changes. The fields they set are laid onto the ingredient's current version and every other field keeps its current value, exactly as getCustomIngredientPendingChangesDiff shows. The result is saved as the ingredient's new current version, and the pending changes close. Recipes already using the ingredient keep the version they use. Send the comparison's main_version_id as If-Match and its changes_hash in the body, so the confirm lands only what the person reviewed. Only a person signed in to BetterMenu can confirm.

POST
/studio/custom-ingredients/{custom_ingredient_id}/pending-changes/confirm

Path Parameters

custom_ingredient_id*Custom Ingredient Id

Header Parameters

If-Match*string

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

Request Body

application/json
  1. body

Request body for confirming a custom ingredient's pending changes.

changes_hash*Changes Hash

The changes_hash of the comparison the person reviewed, from getCustomIngredientPendingChangesDiff. The confirm is refused when it is not the current comparison's hash.

Length1 <= length

Response Body

Successful Response

application/json
  1. response

The ingredient after its pending changes were confirmed.

data and version_id are the ingredient's new current version, which recipes use from now on for new pins. pending_changes is the closed pending changes, with state confirmed.

data*

A custom ingredient's full data: identity, lifecycle status, serving/nutrition data, and descriptive attributes.

meta*

Response metadata.

version_id*Version Id

The ingredient's new current version. Send it as If-Match on the next edit.

Match^[0-9A-HJKMNP-TV-Z]{26}$
pending_changes*

The open pending changes of a custom ingredient, without their content.

Pending changes are proposed edits kept beside the ingredient. Recipes, search and the ingredient list keep using the ingredient's current version until a person confirms them. Read their content with getCustomIngredientPendingChanges.

Example Request
curl -X POST 'https://api.bettermenu.live/studio/custom-ingredients/string/pending-changes/confirm' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "changes_hash": "3b7e0c2f9a1d4e5b8c6f7a2d1e0b9c8a7f6e5d4c3b2a1908f7e6d5c4b3a29180"}'
Example Response
{  "data": {    "id": "stringstringstringstringst",    "org_id": "stringstringstringstrings",    "status": "draft",    "name": "string",    "entry_method": "form",    "notes": "string",    "reference_amount": "string",    "reference_unit": "string",    "household_measure": "string",    "reference_quantity_g": "string",    "density_g_per_ml": "string",    "nutrients": [      {        "id": "stringstringstringstringst",        "unit": "string",        "amount": "string",        "market_nutrients": {          "property1": {            "bmid": "string",            "nutrient_id": 1          },          "property2": {            "bmid": "string",            "nutrient_id": 1          }        }      }    ],    "approved_markets": [      "US"    ],    "brand": "string",    "manufacturer": "string",    "source_url": "string",    "attributes": [      {        "key": "string",        "type": "string",        "value": null,        "searchable": false      }    ],    "artifacts": [      {        "key": "string",        "kind": "string",        "uploaded_at": "2019-08-24T14:15:22Z"      }    ],    "ingredient_statement": "string",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "meta": {    "version": "string",    "request_id": "string",    "timestamp": "string"  },  "version_id": "string",  "pending_changes": {    "id": "string",    "state": "open",    "base_version_id": "string",    "tip_version_id": "string",    "origin": "member",    "created_at": "2019-08-24T14:15:22Z",    "created_by": "string",    "last_commit_at": "2019-08-24T14:15:22Z"  }}

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

Start freeNo card needed.