Create and Retrieve a Nutrition Label with the Genesis Foods GraphQL API

Create and Retrieve a Nutrition Label with the Genesis Foods GraphQL API

Generating a Nutritional Label with the Genesis Foods GraphQL API takes a few steps which are detailed below. These steps assume that you have already created and approved a recipe.

Please ensure you start with https://esharesearch.atlassian.net/wiki/spaces/GGA/pages/3293282331

For a full API Reference please refer to Genesis Foods GraphQL API Reference

 

Genesis GraphQL API Endpoint

Production: https://api.trustwell.com/genesis

Preview: https://api-preview.trustwell.com/genesis

In the examples below, many responses have been truncated for readability.

Step 1 - Find Recipes that are Approved

query { foods { search( input: { foodTypes: Recipe, itemSourceFilter: Customer, documentStatusFilter: All, versionFilter: All, searchText: ""} ) { foodSearchResults { name id isApproved } } } }
{ "data": { "foods": { "search": { "foodSearchResults": [ { "name": "Food 1", "id": "5112c40e-XXXX-XXXX-XXXX-6721b3907ffd", "isApproved": false }, { "name": "Food 2", "id": "04ebbf90-XXXX-XXXX-XXXX-5956c1ed5bab", "isApproved": true }, { "name": "Food 3", "id": "102bf0de-XXXX-XXXX-XXXX-ee69ecb67fee", "isApproved": true } ] } } } }

Step 2 - Create Label

mutation { label { unitedStates2016 { create (input: { name: "Testing Label Create", labelStyle: StandardVertical, recommendationProfile: Adult }) { label { id name } } } } }
{ "data": { "label": { "unitedStates2016": { "create": { "label": { "id": "531e6a9e-XXXX-XXXX-XXXX-b2ba011f2b32", "name": "Testing Label Create" } } } } } }

Step 3 - Add Recipe to Label

mutation { label { unitedStates2016 { setLabelItems (input: { foodIds: "102bf0de-XXXX-XXXX-XXXX-ee69ecb67fee", labelId: "531e6a9e-XXXX-XXXX-XXXX-b2ba011f2b32" }) { __typename } } } }
{ "data": { "label": { "unitedStates2016": { "setLabelItems": { "__typename": "LabelPayload" } } } } }

Step 4 - Get Label Image

query { labels { getLabelImage (input: { labelId: "531e6a9e-XXXX-XXXX-XXXX-b2ba011f2b32" }) } }

The response for this call is an svg stream… when rendered it will be the label image you requested. For Example:

image-20250813-145402.png



 

Clicking links may navigate you away from the Trustwell site.