Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Searching for foods is a key action that users utilize to build recipes.

Search results are paginated.

...

Expand
titleResponse
Code Block
languagejson
"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

Analyzing your foods is a core use case for Genesis. There are 2 types of analyses you can request: Gross and Net.

Expand
titleRequest

Query

Code Block
languagegraphql
query($input : GetAnalysisInput!){
    analysis{
        getAnalysis(input: $input){
            analysis{
                analysisType
                nutrientInfos{
                    nutrient{
                        id
                        name
                    }
                    value
                }
                amountAnalyzed{
                    quantity{
                        value
                    }
                    unit{
                        name
                    }
                }
                weight{
                   quantity{
                        value
                    }
                    unit{
                        name
                    } 
                }
            }
        }
    } 
}

GraphQL Variables

Code Block
{
    "input":{
        "foodId":"855f573f-9977-4625-8241-c6a3ee847b84",
        "analysisInput":{
            "analysisType": "Net",
            "amount":{
                "quantity":"100",
                "unitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"
            }
        }
    }
}

...