Skip to content
Skip to Content
Docs
Studio

Confirm Added Sugars

Records that a person reviewed the recipe's Added Sugars report and accepts it. Once confirmed, the Added Sugars line appears on the recipe's nutrition label and in its nutrition analysis. Send the report_hash of the report the person was shown and the recipe's current version_id as If-Match.

The request is refused when the hash is not the current report's (the report changed since it was read), when the report still has unanswered rows or findings, or when the recipe changed since If-Match. Adding, removing or swapping an ingredient (or a custom ingredient's version), changing the demographic or changing an answer afterwards makes the confirmation stale and it must be given again. Changing a quantity, a serving size or the number of servings does not: amounts, declarations and the label are recomputed, and a quantity that would push added sugars above total sugars is still refused.

Confirming records the person's attestation, who is taken from the credentials and the channel from how the request arrived. An agent must only call this after the person has asked it to confirm the report. Repeating a request for a report that is already confirmed records nothing new and returns the existing confirmation.

POST
/studio/recipes/{recipe_id}/added-sugars-report/confirm

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

The report a person is confirming.

The person is identified by the request's credentials and the channel by how the request arrived; neither is accepted here.

report_hash*Report Hash

The report_hash of the Added Sugars report the person was shown, exactly as returned when the report was read. The request is refused when it is not the hash of the recipe's current report, so a person can only confirm what they saw.

Match^[0-9a-f]{64}$

Response Body

Successful Response

application/json
  1. response

Response for confirmRecipeAddedSugarsReport.

The read envelope with its data widened. version_id is the version after the label refresh; pass it as If-Match on the next change.

data*

The shared report data, with what this confirmation did.

report, report_hash and confirmation are those of the version the request ends at, read the way the read operation reads them, so a client parses the confirm response with the read model and loses nothing. The fields below are additive and describe the request itself.

meta*

Response metadata.

version_id?|

The version the report was read at; pass it as If-Match on the next change to this report. Null only for a recipe that was never versioned. The ETag is derived from it and does not change when confirmation changes, so do not use the ETag to detect that.

Example Request
curl -X POST 'https://api.bettermenu.live/studio/recipes/string/added-sugars-report/confirm' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "report_hash": "string"}'
Example Response
{  "data": {    "report": {      "market": "US",      "engine": {        "regulatory_package_version": "string",        "suggester_allowed": true,        "suggester_used": true,        "suggester_prompt_version": "string"      },      "determination": {        "basis": "batch",        "reference_weight_grams": "string",        "rows": [          {            "ingredient_row_id": "stringstringstringstringst",            "ingredient": {              "ingredient_id": "string",              "custom_ingredient_id": "stringstringstringstringst",              "custom_ingredient_version_id": "string",              "name": "string",              "quantity_grams": "string",              "total_sugars_per_100g": "string",              "total_sugars_grams": "string"            },            "derived": {              "resolution": "settled",              "path": [                {                  "question": "string",                  "answer": "yes",                  "docs_url": "string"                }              ],              "contributes": true,              "factor": "string",              "added_sugars_grams": "string",              "settled_by": "data_check",              "open_reasons": [                "sugars_missing"              ],              "citation": {                "authority": "regulation",                "cite": "string",                "quote": "string"              },              "added_sugars_per_100g": "string"            },            "suggested": {              "by": "suggester",              "confidence": "confident",              "added_sugars_grams": "string",              "quantity_grams_when_entered": "string",              "reason": "string",              "citation": {                "authority": "regulation",                "cite": "string",                "quote": "string"              },              "provenance": {                "model": "string",                "fallback_model_used": true,                "prompt_version": "string",                "config_version": 0,                "settled_by_stage": "string"              },              "question": "string",              "added_sugars_per_100g": "string"            },            "caller": {              "action": "accept_suggestion",              "added_sugars_grams": "string",              "quantity_grams_when_entered": "string",              "entered_added_sugars_per_100g": "string",              "reason": "string",              "supplier_reference": "string",              "actor": {                "type": "member",                "id": "string"              },              "channel": "studio",              "at": "2019-08-24T14:15:22Z"            },            "effective": {              "added_sugars_grams": "string",              "source": "data_check",              "added_sugars_per_100g": "string"            },            "checks": [              {                "id": "sugar_data",                "status": "ok",                "summary": "string",                "why_it_matters": "string",                "citation": {                  "authority": "regulation",                  "cite": "string",                  "quote": "string"                },                "docs_url": "string"              }            ]          }        ],        "totals": {          "added_sugars_grams": "string",          "total_sugars_grams": "string"        },        "declarations": [          {            "serving_id": "stringstringstringstrings",            "serving_description": "string",            "servings_per_container": "string",            "added_sugars_grams_per_serving": "string",            "total_sugars_grams_per_serving": "string",            "declared_grams": {              "outcome": "zero",              "value": "string"            },            "total_sugars_declared_grams": {              "outcome": "zero",              "value": "string"            },            "population": "adults_and_children_over_4",            "drv_grams": "string",            "percent_dv": "string",            "dv_basis": "unrounded_amount"          }        ],        "findings": [          {            "code": "row_added_sugar_invalid",            "row_id": "string",            "serving_id": "string"          }        ]      },      "presentation": {        "readiness": {          "total_rows": 0,          "settled_rows": 0,          "suggested_rows": 0,          "open_rows": 0,          "ready_to_confirm": true        },        "unresolved_rows": [          "stringstringstringstringst"        ],        "total_sugars_complete": true,        "rows_without_total_sugars": [          "stringstringstringstringst"        ]      },      "checks": [        {          "id": "sugar_data",          "status": "ok",          "summary": "string",          "why_it_matters": "string",          "citation": {            "authority": "regulation",            "cite": "string",            "quote": "string"          },          "docs_url": "string"        }      ]    },    "report_hash": "string",    "confirmation": "confirmed",    "confirmation_stands": true,    "already_confirmed": true,    "label": "refreshed",    "confirmation_record": {      "confirmation_id": "string",      "confirmed_at": "2019-08-24T14:15:22Z",      "confirmed_by": "string",      "channel": "studio"    }  },  "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.