Setting Serving Size via the Genesis API

Setting the Serving Size for a Recipe via the Genesis API is not immediately obvious. The following guide will help clarify the steps necessary for building a request that will set one of the three options available in the Genesis Food software.

In Genesis Food, you can set the number of servings that a Recipe makes, or you can set how much a single serving weighs, or that a single serving is a certain measure. Each choice requires a specific set of Conversions to be set via the Genesis API.

A Conversion is comprised of a “From” part and a “To” part, and in the case of Serving Size, your “To” part will almost always be in Grams. Each “part” of the Conversion is comprised of a Quantity (typically a Double) and UnitId (a guid). The quantity is how much, the UnitId is what measure it’s in. For example, Quantity = 10, Measure = Grams.

UnitIds are guids that can be found by using the ListUnits endpoint. That endpoint will return a response that contains a collection of all Units, their Names, and their UnitIds.

How you build the Conversions will determine which Serving Size option is set.

For the first two options, setting “A recipe makes” will automatically calculate a Conversion for “A serving weighs” and vice-versa.

To set the third option, “A serving is,” requires a special case.

To set “A recipe makes” Serving Size

  1. Create a Conversion as follows:

    1. From: Quantity = 10, UnitId = a7df0af5-001f-0000-7484-751e8eaf05c6 (i.e. Serving)

    2. To: Quantity = -1, UnitId = a7df0af5-0008-0000-7484-751e8eaf05c6 (i.e. Gram)

The Conversion part of the request would like this:

The result in the Genesis Food application is:

To set “A serving weighs” Serving Size

  1. Create a Conversion as follows:

    1. From: Quantity = 1, UnitId = a7df0af5-001f-0000-7484-751e8eaf05c6 (i.e. Serving)

    2. To: Quantity = 97.45, UnitId = a7df0af5-0008-0000-7484-751e8eaf05c6 (i.e. Gram)

The Conversion part of the request would like this:

The result in the Genesis Food application is:

 

To set “A serving is” Serving Size

This example will be creating a volume Conversion and then specifying that the serving size should be the newly created volume Conversion. It does not have to be a volume Conversion, but this Serving Size option is typically used for that since either of the first two options can handle all non-volume Conversions.

  1. Create TWO Conversions as follows:

  2. Create the “Volume” Conversion

    1. From: Quantity = 100, UnitId = a7df0af5-0008-0000-7484-751e8eaf05c6 (i.e. Gram)

    2. To: Quantity = 50, UnitId = a7df0af5-000b-0000-7484-751e8eaf05c6 (i.e. Milliliter)

  3. Create the “Dry” Conversion

    1. From: Quantity = 50, UnitId = a7df0af5-0008-0000-7484-751e8eaf05c6 (i.e. Milliliter)

    2. To: Quantity = 1, UnitId = a7df0af5-000b-0000-7484-751e8eaf05c6 (i.e. Serving)

The Conversion part of the request would look like this:

The results in the Genesis Food application is:

Related articles