Skip to content
Skip to Content
Docs
Studio

Attach Recipe Protein Quality Document

Attach a document (lab report, supplier sheet) to the protein quality value.

Optional: a value with no document is accepted. The document is stored once by its SHA-256 and the value points at it, so attaching another one commits a new version and earlier versions keep theirs.

Send If-Match with the recipe's current version_id: a missing one is refused with 412, a stale one with 409.

PUT
/studio/recipes/{recipe_id}/protein-quality/document

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

A document supporting the protein quality value, sent inline.

file_name*File Name

The document's file name.

Length1 <= length <= 255
content_type*ProteinQualityDocumentType

The document's media type: PDF, PNG or JPEG.

Value in"application/pdf""image/png""image/jpeg"
content_base64*Content Base64

The document's bytes, base64-encoded; at most 4194304 bytes once decoded.

Length1 <= length

Response Body

Successful Response

application/json
  1. response

Standard response envelope.

data*

The recipe's protein quality value, claim and display choice.

meta*

Response metadata.

version_id?|

Version committed for this mutation; pass on the next request as If-Match for optimistic concurrency. Present only on versions declaring the recipe_versioning capability.

Example Request
curl -X PUT 'https://api.bettermenu.live/studio/recipes/string/protein-quality/document' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "file_name": "string",  "content_type": "application/pdf",  "content_base64": "string"}'
Example Response
{  "data": {    "recipe_id": "string",    "quality": {      "method": "pdcaas",      "score": "string",      "source": "lab_finished_product",      "basis_note": "string",      "entered_by": "string",      "entered_at": "2019-08-24T14:15:22Z",      "document": {        "sha256": "string",        "file_name": "string",        "content_type": "string",        "size_bytes": 0,        "uploaded_by": "string",        "uploaded_at": "2019-08-24T14:15:22Z",        "download_url": "string"      }    },    "claim": "none",    "low_score_display": "percent_dv",    "main_protein_source": {      "ingredient_name": "string",      "share": "string"    },    "ingredients_changed_since_entered": true,    "check_facts": {}  },  "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.