Skip to content
Skip to Content
Docs
Studio

Set Custom Ingredient Serving

Replace a custom ingredient's serving / gram basis in one commit — every field is taken verbatim from the request (destructive replace, like setRecipeIngredients); an omitted field clears to null. reference_quantity_g is the derived as-sold gram basis the nutrition-calc adapter uses to convert stored nutrient amounts to a per-100g basis. Allowed while the ingredient is draft or active; rejected once archived.

PUT
/studio/custom-ingredients/{custom_ingredient_id}/serving

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

Replace a custom ingredient's serving / gram basis.

Full replace semantics — every field is taken verbatim from the request (omitted fields become None).

reference_amount?||

Serving as entered, e.g. 15 / 100 / 1.

reference_unit?|

Unit the reference amount is expressed in — metric (g, ml), household (tablespoon, cup), or a count (e.g. 'cookie', 'slice').

household_measure?|

Display/source provenance, e.g. "1 Tablespoon".

reference_quantity_g?||

Derived as-sold gram basis.

density_g_per_ml?number||null

Response Body

Successful Response

application/json
  1. response

Response for the set-custom-ingredient-serving endpoint.

data*

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

meta*

Response metadata.

version_id?|

Version committed for this update; pass on a future mutation as If-Match for optimistic concurrency.

Example Request
curl -X PUT 'https://api.bettermenu.live/studio/custom-ingredients/string/serving' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{}'
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"}

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

Start freeNo card needed.