Classic REST API to GraphQL API

Classic REST API to GraphQL API

The transition from the Genesis Classic REST API to the new Genesis Foods GraphQL API marks an exciting evolution in how developers can interact with our services. This documentation aims to provide a foundational understanding of this transition, highlighting key queries and mutations that correspond to the existing REST endpoints. While this guide does not offer a comprehensive mapping of every endpoint, it serves as a valuable starting point for customers looking to adapt their applications to the new GraphQL API. By leveraging the flexibility and efficiency of GraphQL, we hope to enhance your development experience and empower you to build more dynamic and responsive applications.

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.

 

Classic Service

Classic REST Endpoint

Genesis GraphQL

Classic Service

Classic REST Endpoint

Genesis GraphQL

FoodQueryService

 

Queries

 

SearchByGroup

The FoodQuery is a powerful GraphQL query used to retrieve foods and create searches for them.

Example: https://esharesearch.atlassian.net/wiki/spaces/GGA/pages/3293282331/Getting+Started+with+the+Trustwell+Genesis+Foods+GraphQL+API#Searching

 

SearchByName

 

SearchByModifiedDateRange

 

SearchByProperty

 

GetFoodByFoodId

 

GetFoodByUserCode

 

GetConversions

Use FoodQuery to get the food and specifically ask for the conversions property.

 

GetAnalysis

You can use the AnalysisQuery to request an analysis of a specific food by its food ID.

Example: https://esharesearch.atlassian.net/wiki/spaces/GGA/pages/3293282331/Getting+Started+with+the+Trustwell+Genesis+Foods+GraphQL+API#Getting-an-Analysis

 

ListNutrients

Use the NutrientsQuery to get the standard or user added nutrients.

 

ListUnits

Use the UnitsQuery to get the standard units.

 

ListGroups

Use the TagsQuery to get the standard or user added tags.

 

ListAllergens

Use the AllergensQuery to get the standard allergens per regulation.

 

ListAuthorities

Use the RegulationsQuery to get Authorities and Regulations, as well as Recommendation Profiles.

 

ListRecommendationProfiles

 

ListFoods

Deprecated, use FoodQuery

 

ListFoodUserCodes

Deprecated, use FoodQuery

FoodEditService

 

Mutations

 

NewFood

Use the FoodsMutation and call Create to create a new food.

Example: https://esharesearch.atlassian.net/wiki/spaces/GGA/pages/3293282331/Getting+Started+with+the+Trustwell+Genesis+Foods+GraphQL+API#Creating-an-Ingredient
https://esharesearch.atlassian.net/wiki/spaces/GGA/pages/3293282331/Getting+Started+with+the+Trustwell+Genesis+Foods+GraphQL+API#Creating-a-Recipe

 

UpdateFood

Use the FoodsMutation to set the fields on a Food

 

SetCanadianLabel

Use the regulation specific LabelsMutation to create and set properties on a label.

 

SetEULabel

Use the regulation specific LabelsMutation to create and set properties on a label.

 

SetMexicoLabel

Use the regulation specific LabelsMutation to create and set properties on a label.

 

SetUSLabel

Use the regulation specific LabelsMutation to create and set properties on a label.

 

NewAdvancedLabel

Use the LabelsMutation to create any label type.

FoodBuilderService

 

Not currently supported

LabelImageService

 

 

 

GetLabelImageByFoodId

Use the LabelQuery to get the Labels for a food.

Example: https://esharesearch.atlassian.net/wiki/x/qYAY8g

 

GetLabelImageByUserCode

Not currently supported

 

GetBarcodeImage

Not currently supported

 

GetLabelImageForFood

Not currently supported

Clicking links may navigate you away from the Trustwell site.