Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Genesis Graph API URLs:

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

Preview: TBD

Development (Internal Only): https://api-dev.trustwell.com/genesis

Getting started

To start using the Genesis Foods API, you need to -

  • Log into the Genesis Foods application

  • Generate an API Key

    • NOTE: Only Admins with API Access will have the ability to generate an API Key

  • Send the API Key with every request in the header

  • The API has rate and usage limits

  • The API only responds to HTTPS. Any requests sent via HTTP return an HTTP 301 redirect to corresponding HTTPS resources

  • Genesis Foods API is a GraphQL API with a single endpoint. Read more about working with GraphQL API’s here.

Authentication/Authorization

An API Key can be generated in the Genesis Foods application if your user has been given the appropriate permission. Please contact your Account Manager if you don’t see the ability to generate API Keys.

The API Key should be included in the X-API-KEY header with each request.

{
  "X-API-KEY": "XXXYYYYBBBBZZZZ"
}

Searching

Searching for foods is a key action that users utilize to build recipes. Search results are paginated.

 Request

Query

query($input: FoodSearchInput!){
    foods{
        search(input: $input)
        {
            foodSearchResults{
                id
                name
                modified
                created
                versionName
                foodType
                product
                supplier
                isApproved
                versionHistoryId
            }
            totalCount
            pageInfo{
                cursor
                hasNextPage
                startCursor
                endCursor
            }
        }
    }
}

GraphQL Variables

{
    "input":{
        "searchText":"recipe",
        "foodTypes":["Ingredient", "Recipe"],
        "itemSourceFilter":"All",
        "versionFilter":"Latest"
    }
}
 Response
"data": {
        "foods": {
            "search": {
                "foodSearchResults": [
                    ...
                    {
                        "id": "423f0ddd-14b2-4114-8323-7f8ccc11ddac",
                        "name": "granola, prepared from recipe",
                        "modified": "2023-03-27T16:57:27.4906008+00:00",
                        "created": "2023-03-27T16:57:27.4838005+00:00",
                        "versionName": "V1",
                        "foodType": "Ingredient",
                        "product": "USDA",
                        "supplier": "USDA SR-Legacy",
                        "isApproved": true,
                        "versionHistoryId": "4b7f32ab-3bae-469d-bce8-2dfd28b726d0"
                    },
                    {
                        "id": "21b52b33-2fde-498e-9a44-5023f98260b4",
                        "name": "taffy, prepared from recipe",
                        "modified": "2023-03-27T18:53:40.3575528+00:00",
                        "created": "2023-03-27T18:53:40.3504859+00:00",
                        "versionName": "V1",
                        "foodType": "Ingredient",
                        "product": "Canadian Nutrient File",
                        "supplier": "Health Canada (Canadian Nutrient File)",
                        "isApproved": true,
                        "versionHistoryId": "fb308722-32c1-45c8-8666-42ba8e0a329c"
                    },
                    {
                        "id": "a7eaee32-6ecd-4ece-90d0-48300d9d4439",
                        "name": "divinity, prepared from recipe",
                        "modified": "2023-03-27T17:44:05.6121672+00:00",
                        "created": "2023-03-27T17:44:05.6036143+00:00",
                        "versionName": "V1",
                        "foodType": "Ingredient",
                        "product": "USDA",
                        "supplier": "USDA SR-Legacy",
                        "isApproved": true,
                        "versionHistoryId": "db00f784-1a0d-4b14-a4cd-dd53b8487475"
                    },
                    ...
                ],
                "totalCount": 1407,
                "pageInfo": {
                    "cursor": 10,
                    "hasNextPage": true,
                    "startCursor": 0,
                    "endCursor": 1407
                }
            }
        }
    }
}

Getting an Analysis

Querying Standard Entities

Creating an Ingredient

Creating a Recipe

  • No labels