Skip to content
Skip to Content
Docs
Studio

Record Reference Serving Size View

Records that the calling member opened a serving size category and returns it as stored after the change. The category's name and reference amount come from the server, so only its id is sent. Opening a category puts it at the top of the member's Recent list. Each call is kept in the member's own view history, including the search text for a category opened from search.

POST
/studio/reference/serving-sizes/views

Request Body

application/json
  1. body

A serving size category the member opened.

category_id*Category Id

Identifier of the serving size category, as the serving size category endpoints return it.

Match^[A-Za-z0-9][A-Za-z0-9_.:\-]*$
Length1 <= length <= 128
opened_from*ReferenceServingSizeOpenedFrom

The tab the category was opened from: search, recent or saved.

Value in"search""recent""saved"
result_position?|

Where the category appeared in the search results, starting at 1 (at most 10000). Only when opened from search.

query?|

The search text that found the category. Kept in the member's own view history only. Only when opened from search.

Response Body

Successful Response

application/json
  1. response

A serving size category the member opened, with its Saved and Recent state.

category_id*Category Id

Identifier of the serving size category, as the serving size category endpoints return it.

name*Name

The category's name, e.g. Cookies.

reference_amount*Reference Amount

The reference amount customarily eaten at one time, in reference_unit, e.g. 30.

reference_unit*ReferenceAmountUnit

g for grams, or mL for millilitres: the categories whose reference amount is a volume (beverages, juices, milk, cream, shakes, syrups and cooking wine).

Value in"g""mL"
amount_kind*ServingSizeAmountKind

discrete for products eaten in units (cookies, bagels), bulk for products measured out (flour, juice).

Value in"discrete""bulk"
audience*ServingSizeAudience

general or infant_toddler: who the reference amount is set for.

Value in"general""infant_toddler"
data_version*Data Version

Version of the regulatory data the values above come from.

saved*Saved

Whether the member saved this category.

saved_at*|

When the member saved it; null while it is not saved.

first_viewed_at*First Viewed At

When the member first opened it.

Formatdate-time
last_viewed_at*Last Viewed At

When the member last opened it.

Formatdate-time
view_count*View Count

How many times the member opened it.

Example Request
curl -X POST 'https://api.bettermenu.live/studio/reference/serving-sizes/views' \  -H 'Content-Type: application/json' \  -d '{  "category_id": "string",  "opened_from": "search"}'
Example Response
{  "category_id": "string",  "name": "string",  "reference_amount": 0,  "reference_unit": "g",  "amount_kind": "discrete",  "audience": "general",  "data_version": "string",  "saved": true,  "saved_at": "2019-08-24T14:15:22Z",  "first_viewed_at": "2019-08-24T14:15:22Z",  "last_viewed_at": "2019-08-24T14:15:22Z",  "view_count": 0}

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

Start freeNo card needed.