Answer One Added Sugars Row
Records your answer for one ingredient row of the recipe's Added Sugars report and returns the updated report in the same shape as reading it: data holds report, report_hash (the value confirming this report needs) and confirmation, and version_id is the new version. The row is named by its ingredient row id (irow_...), the id of one ingredient row of this recipe: two rows of one food have two row ids.
The action is one of accept_suggestion, set_contribution, add_contribution, remove_contribution or keep. For set_contribution and add_contribution give the amount either as added_sugars_grams (grams in this row at its current quantity) or as added_sugars_per_100g (grams per 100 g of the ingredient), never both: the server turns per-100 g into row grams at the row's current quantity. Each row of the report also carries the counted amount per 100 g (added_sugars_per_100g) so you never divide. A reason and a supplier_reference are optional on every action. Your answer is kept as you gave it, with the row's quantity at the time, the person and the channel. The row's counted grams, the totals, the declarations and the findings are recomputed from it.
An answer that puts a row's, the batch's or a serving's added sugars above its total sugars is rejected and nothing is saved. Nothing is ever lowered to fit.
Every answer saves one new version of the recipe, so an earlier confirmation of the report no longer applies and the Added Sugars line is taken off the recipe's nutrition and labels until the new report is confirmed. Send the recipe's current version_id in the If-Match header.
recipe_id*Recipe Idingredient_row_id*Ingredient Row IdIngredient row id (irow_...) of the row to answer, as the report names it.
^irow_[a-z0-9]{21}$26 <= length <= 26If-Match*stringThe 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.
application/json- body
A person's answer for one ingredient row of the Added Sugars report.
action*CallerActionWhat you are doing with the row.
accept_suggestion: take the row's suggested answer. The row must have a suggestion that proposes grams, or the answer is refused.set_contribution: state the added sugars yourself, in grams in this row (added_sugars_grams) or per 100 g of the ingredient (added_sugars_per_100g); give exactly one of them.add_contribution: the same asset_contribution; either may be used on any row.remove_contribution: state that the row has no added sugars (0 g).keep: confirm the answer the data checks already gave the row. A row the data checks left open has none to keep.
"accept_suggestion""set_contribution""remove_contribution""add_contribution""keep"added_sugars_grams?||Grams of added sugars in this row at its current quantity, zero or more. For set_contribution and add_contribution give exactly one of this and added_sugars_per_100g; not allowed for any other action. At most six decimal places are accepted. It is stored as you enter it, with the row's quantity at the time. If the row's quantity changes later, the amount that counts is scaled to the new quantity.
added_sugars_per_100g?||Grams of added sugars per 100 g of this ingredient, from 0 to 100, as a supplier specification states it; at most six decimal places are accepted. The alternative to added_sugars_grams: for set_contribution and add_contribution give exactly one of the two; not allowed for any other action. The server works out the grams in this row at its current quantity (per 100 g x quantity / 100) and stores them as if you had given them. The stored grams are that exact product, never rounded, so they can carry more than six decimal places (3.333333 on a 3 g row is stored as 0.0999999900) even though the figure you give is limited to six; the figures that count are shown at four decimal places in effective. The per-100 g figure is kept beside them as the way you entered it (caller.entered_added_sugars_per_100g). If the row's quantity changes later, the grams that count scale with it, as for added_sugars_grams.
reason?|Optional. Why you gave this answer, for the record.
supplier_reference?|Optional. A reference to the document that supports the answer, such as a supplier specification sheet and its date.
Successful Response
application/json- response
GET Added Sugars report response envelope.
This is the shared envelope for reading, patching and confirming the report.
data*The report of one recipe version and its confirmation state.
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.
curl -X PATCH 'https://api.bettermenu.live/studio/recipes/string/added-sugars-report/rows/stringstringstringstringst' \ -H 'If-Match: string' \ -H 'Content-Type: application/json' \ -d '{ "action": "accept_suggestion"}'{ "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" }, "meta": { "version": "string", "request_id": "string", "timestamp": "string" }, "version_id": "string"}