Introduction
The Trustwell Genesis Foods API provides a powerful way to access food data, perform analyses, query standard entities, and create new ingredients or recipes. Built on GraphQL, the API allows you to define precisely what data you need and retrieve it efficiently. This guide will walk you through how to authenticate and start making queries and mutations using the API.
Obtaining your API Key
To start using the Genesis Foods API, follow these steps:
Log into the Genesis Foods application.
Generate an API Key.
Only Administrators with API Access will have the ability to generate an API Key.
Include this API Key in the request headers for every request you make.
Example API Key Format
{ "X-API-KEY": "XXXYYYYBBBBZZZZ" }
Notes
The API enforces rate and usage limits.
Requests are only processed over HTTPS. HTTP requests will be redirected to the corresponding HTTPS resource.
The Genesis Foods API uses GraphQL and has a single endpoint. For more information on how GraphQL works, please visit http://graphql.org.
Authentication/Authorization
You can generate an API Key through the Genesis Foods application, provided your user has the necessary permissions. If you do not have access to generate API Keys, please contact your Account Manager for assistance.
Include your API Key in the request headers
{ "X-API-KEY": "XXXYYYYBBBBZZZZ" }
API Operations: Queries and Mutations
The Trustwell Genesis Foods API offers a range of operations that allow you to interact with the system through both queries and mutations. Queries enable you to fetch data, such as searching for foods or retrieving nutritional analysis, while mutations allow you to create or update data, like adding ingredients or recipes. Each operation is designed to be flexible and powerful, giving you control over the specific data you need and minimizing unnecessary overhead.
Below are examples of common API operations, showing how to construct requests and handle responses for both queries and mutations.
Searching
Searching for foods is a key action that users utilize to build recipes. Search results are paginated.