GetFoodByUserCode

Summary: Retrieves the metadata for a food identified by the specified UserCode value.

Soap Action: http://ns.esha.com/2013/genesisapi/GetFoodByUserCode

Request Type: GetFoodByUserCodeRequest

  • UserCode
    • Type: String
    • The user code for the food Requested

Response Type: FoodMetadataResponse

  • Food
    • Type: exlx:FoodDto
    • The metadata of the requested food
  • FoodItems
    • Type: FoodDto[]
    • The metadata for the food items (if recipe)
  • NutrientProfile
    • Type: exlx:NutrientProfileDto
    • The nutrient profile for the requested food (if ingredient)
  • Status
    • Type: exlx:ResultStatus
    • The ResultStatus of the given response
  • ResponseVersion
    • Type: exlx:XmlVersion
    • The version of the given response.


SOAP Request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:gen="http://ns.esha.com/2013/genesisapi">
   <soap:Header/>
   <soap:Body>
      <gen:FoodMetadataRequest>
         <gen:UserCode>REC-123</gen:UserCode>
      </gen:FoodMetadataRequest>
   </soap:Body>
</soap:Envelope>
SOAP Response
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
      <a:Action s:mustUnderstand="1">http://ns.esha.com/2013/genesisapi/getfoodresponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <FoodMetadataResponse xmlns="http://ns.esha.com/2013/genesisapi">
         <Recipe>
            <Id xmlns="http://ns.esha.com/2013/exlx">8980ff36-f881-276d-5ef8-ee69ecb67fee</Id>
            <Name xmlns="http://ns.esha.com/2013/exlx">
               <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">API Recipe</Value>
            </Name>
            <CommonName xmlns="http://ns.esha.com/2013/exlx">
               <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Recipe</Value>
            </CommonName>
            <Notes xmlns="http://ns.esha.com/2013/exlx">NOTE 1
NOTE 2
NOTE 3</Notes>
            <AmountCost xmlns="http://ns.esha.com/2013/exlx">
               <Amount>
                  <Quantity Type="Double">1</Quantity>
                  <UnitId>a7df0af5-0063-0000-7484-751e8eaf05c6</UnitId>
               </Amount>
               <Cost>0.75</Cost>
            </AmountCost>
            <Conversions xmlns="http://ns.esha.com/2013/exlx">
               <Conversion>
                  <From>
                     <Quantity Type="Double">1</Quantity>
                     <UnitId>a7df0af5-001f-0000-7484-751e8eaf05c6</UnitId>
                  </From>
                  <ConversionFactor Type="Double">1</ConversionFactor>
                  <To>
                     <Quantity Type="Double">100</Quantity>
                     <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId>
                  </To>
               </Conversion>
            </Conversions>
            <Items xmlns="http://ns.esha.com/2013/exlx">
               <FoodItem>
                  <FoodId>752eb9c2-5767-71f9-bede-d3a51c0fdeba</FoodId>
                  <Amount>
                     <Quantity Type="Double">100</Quantity>
                     <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId>
                  </Amount>
               </FoodItem>
            </Items>
            <Created xmlns="http://ns.esha.com/2013/exlx">
               <DateTime xmlns="http://ns.esha.com/2013/types">2018-08-21T14:52:00.0000000</DateTime>
               <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
            </Created>
            <Modified xmlns="http://ns.esha.com/2013/exlx">
               <DateTime xmlns="http://ns.esha.com/2013/types">2018-08-21T15:01:00.0000000</DateTime>
               <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
            </Modified>
            <LegacyKey xmlns="http://ns.esha.com/2013/exlx">661518465</LegacyKey>
            <UserCode xmlns="http://ns.esha.com/2013/exlx">REC-123</UserCode>
            <IngredientStatementSettings xmlns="http://ns.esha.com/2013/exlx">
               <IngredientStatementSetting>
                  <Authority>
                     <Id>bbf4846d-8400-43bb-944d-6021fda98225</Id>
                  </Authority>
                  <FoodId>00000000-0000-0000-0000-000000000000</FoodId>
                  <ItemsOverrideText>
                     <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">INGREDIENTS: Ingredient Common Name.</Value>
                     <Value xml:lang="es-MX" xmlns="http://ns.esha.com/2013/types">INGREDIENTES: Ingredient Common Name.</Value>
                     <Value xml:lang="fr-CA" xmlns="http://ns.esha.com/2013/types">INGRÉDIENTS: Ingredient Common Name.</Value>
                  </ItemsOverrideText>
                  <StatementNameOverride>
                     <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Recipe</Value>
                     <Value xml:lang="es-MX" xmlns="http://ns.esha.com/2013/types">Recipe</Value>
                     <Value xml:lang="fr-CA" xmlns="http://ns.esha.com/2013/types">Recipe</Value>
                  </StatementNameOverride>
                  <CompositionBehavior>Merged</CompositionBehavior>
               </IngredientStatementSetting>
            </IngredientStatementSettings>
            <AllergenStatements xmlns="http://ns.esha.com/2013/exlx">
               <AllergenStatement>
                  <Text>
                     <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Contains Egg, Fish, Milk, Peanut, Shellfish, Soy, Tree Nuts, Wheat.|May also contain Celery, Crustaceans, Gluten, Lupin, Molluscs, Mustard, Sesame Seeds, Sulphites.</Value>
                     <Value xml:lang="es-MX" xmlns="http://ns.esha.com/2013/types">Contiene Huevo, Pescados, Leche, Cacahuete, Crustáceos, Soya, Tuercas del árbol, Trigo.|Puede tambien contener Apio, Crustáceos, Gluten, Lupin, Moluscos, Mostaza, Semillas de Sésamo, Los Sulfitos.</Value>
                     <Value xml:lang="fr-CA" xmlns="http://ns.esha.com/2013/types">Contient Oeuf, Poissons, Lait, Arachide, Mollusques et crustacés, Soja, Noix, Blé.|Peut egalement contenir Céleri, Crustacés, Gluten, Lupin, Mollusques, Moutarde, Graines de Sésame, Sulfites.</Value>
                  </Text>
                  <Authority>
                     <Id>bbf4846d-8400-43bb-944d-6021fda98225</Id>
                  </Authority>
                  <IsUserOverridden>false</IsUserOverridden>
                  <AllergenGroups>
                     <Id>f01975c0-019b-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-019a-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0191-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0192-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0199-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-019f-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0193-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-01a0-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-019c-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0194-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-019d-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0195-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0196-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-019e-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0197-0000-ff88-2a01e505d63d</Id>
                     <Id>f01975c0-0198-0000-ff88-2a01e505d63d</Id>
                  </AllergenGroups>
               </AllergenStatement>
            </AllergenStatements>
            <IngredientStatements xmlns="http://ns.esha.com/2013/exlx">
               <IngredientStatement>
                  <Text>
                     <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">INGREDIENTS: Ingredient Common Name.</Value>
                     <Value xml:lang="es-MX" xmlns="http://ns.esha.com/2013/types">INGREDIENTES: Ingredient Common Name.</Value>
                     <Value xml:lang="fr-CA" xmlns="http://ns.esha.com/2013/types">INGRÉDIENTS: Ingredient Common Name.</Value>
                  </Text>
                  <Authority>
                     <Id>bbf4846d-8400-43bb-944d-6021fda98225</Id>
                  </Authority>
                  <IsUserOverridden>false</IsUserOverridden>
               </IngredientStatement>
            </IngredientStatements>
            <Brand xmlns="http://ns.esha.com/2013/exlx">
               <Supplier>Api Supplier</Supplier>
               <Product>Api Product</Product>
            </Brand>
            <Groups xmlns="http://ns.esha.com/2013/exlx">
               <Id>6748e1fb-0191-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0192-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0193-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0194-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0195-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0196-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0197-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0198-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-0199-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-019a-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-019b-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-019c-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-019d-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-019e-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-019f-0000-1900-705b14f8f910</Id>
               <Id>6748e1fb-01a0-0000-1900-705b14f8f910</Id>
            </Groups>
         </Recipe>
         <ResponseVersion>1.0.0.0</ResponseVersion>
         <Status>
            <StatusMessage>Ok</StatusMessage>
            <StatusCode>200</StatusCode>
         </Status>
      </FoodMetadataResponse>
   </s:Body>
</s:Envelope>
REST Request
POST http://localhost:80/rest/FoodQueryService.svc/GetFoodByUserCode HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={"UserCode":"REC-123"}
REST Response
{
    "Food": {
        "$type": "Esha.DomainModel.Serialization.RecipeDto, Esha.DomainModel.Serialization",
        "HaccpIdsSpecified": false,
        "CookMethod": null,
        "CookTemperature": null,
        "CookTime": null,
        "Instructions": null,
        "HaccpHeadingLevelSpecified": false,
        "PanSize": null,
        "PreparationTime": null,
        "ContentClaimReferenceIdSpecified": false,
        "DefinedServingWeightConversion": null,
        "NutrientContentClaimsText": null,
        "FoodType": 82,
        "Name": {
            "en-US": "API Recipe"
        },
        "CommonName": {
            "en-US": "Recipe"
        },
        "Description": null,
        "Notes": "NOTE 1\r\nNOTE 2\r\nNOTE 3",
        "DefiningAmount": null,
        "AmountCost": {
            "Amount": {
                "Quantity": {
                    "Value": "1",
                    "Type": 14
                },
                "UnitId": "a7df0af5-0063-0000-7484-751e8eaf05c6"
            },
            "Cost": 0.75
        },
        "DefaultWeightUnitIdSpecified": false,
        "ConversionMapIdSpecified": false,
        "Conversions": [
            {
                "From": {
                    "Quantity": {
                        "Value": "1",
                        "Type": 14
                    },
                    "UnitId": "a7df0af5-001f-0000-7484-751e8eaf05c6"
                },
                "ConversionFactor": {
                    "Value": "1",
                    "Type": 14
                },
                "To": {
                    "Quantity": {
                        "Value": "100",
                        "Type": 14
                    },
                    "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6"
                }
            }
        ],
        "Items": [
            {
                "FoodId": "752eb9c2-5767-71f9-bede-d3a51c0fdeba",
                "Amount": {
                    "Quantity": {
                        "Value": "100",
                        "Type": 14
                    },
                    "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6"
                },
                "Note": null
            }
        ],
        "ItemsSpecified": true,
        "AnalysesSpecified": false,
        "GlycemicIndex": null,
        "Created": {
            "DateTime": "2018-08-21T14:52:00.0000000",
            "UtcOffsetInMinutes": 0
        },
        "CreatedSpecified": true,
        "Modified": {
            "DateTime": "2018-08-21T15:01:00.0000000",
            "UtcOffsetInMinutes": 0
        },
        "ModifiedSpecified": true,
        "LegacyKey": 661518465,
        "LegacyKeySpecified": true,
        "LegacyNutrientRefNumSpecified": false,
        "LegacyYieldKeySpecified": false,
        "UserCode": "REC-123",
        "UsdaCodeSpecified": false,
        "EshaCodeSpecified": false,
        "OwnerName": null,
        "AlternateNamesSpecified": false,
        "AllergenStatementSettingsSpecified": false,
        "IngredientStatementSettings": [
            {
                "ItemsOverrideText": {
                    "en-US": "INGREDIENTS: Ingredient Common Name.",
                    "es-MX": "INGREDIENTES: Ingredient Common Name.",
                    "fr-CA": "INGRÉDIENTS: Ingredient Common Name."
                },
                "StatementNameOverride": {
                    "en-US": "Recipe",
                    "es-MX": "Recipe",
                    "fr-CA": "Recipe"
                },
                "AdditionalItems": null,
                "CompositionBehavior": 77,
                "Authority": {
                    "Name": null,
                    "Iso3166Alpha2": null,
                    "Iso3166Alpha3": null,
                    "Iso3166NumericSpecified": false,
                    "Id": "bbf4846d-8400-43bb-944d-6021fda98225",
                    "IdSpecified": true
                },
                "FoodId": "00000000-0000-0000-0000-000000000000",
                "CreatedSpecified": false,
                "ModifiedSpecified": false,
                "IdSpecified": false
            }
        ],
        "IngredientStatementSettingsSpecified": true,
        "AllergenStatements": [
            {
                "AllergenGroupIds": [
                    "f01975c0-019b-0000-ff88-2a01e505d63d",
                    "f01975c0-019a-0000-ff88-2a01e505d63d",
                    "f01975c0-0191-0000-ff88-2a01e505d63d",
                    "f01975c0-0192-0000-ff88-2a01e505d63d",
                    "f01975c0-0199-0000-ff88-2a01e505d63d",
                    "f01975c0-019f-0000-ff88-2a01e505d63d",
                    "f01975c0-0193-0000-ff88-2a01e505d63d",
                    "f01975c0-01a0-0000-ff88-2a01e505d63d",
                    "f01975c0-019c-0000-ff88-2a01e505d63d",
                    "f01975c0-0194-0000-ff88-2a01e505d63d",
                    "f01975c0-019d-0000-ff88-2a01e505d63d",
                    "f01975c0-0195-0000-ff88-2a01e505d63d",
                    "f01975c0-0196-0000-ff88-2a01e505d63d",
                    "f01975c0-019e-0000-ff88-2a01e505d63d",
                    "f01975c0-0197-0000-ff88-2a01e505d63d",
                    "f01975c0-0198-0000-ff88-2a01e505d63d"
                ],
                "Text": {
                    "en-US": "Contains Egg, Fish, Milk, Peanut, Shellfish, Soy, Tree Nuts, Wheat.|May also contain Celery, Crustaceans, Gluten, Lupin, Molluscs, Mustard, Sesame Seeds, Sulphites.",
                    "es-MX": "Contiene Huevo, Pescados, Leche, Cacahuete, Crustáceos, Soya, Tuercas del árbol, Trigo.|Puede tambien contener Apio, Crustáceos, Gluten, Lupin, Moluscos, Mostaza, Semillas de Sésamo, Los Sulfitos.",
                    "fr-CA": "Contient Oeuf, Poissons, Lait, Arachide, Mollusques et crustacés, Soja, Noix, Blé.|Peut egalement contenir Céleri, Crustacés, Gluten, Lupin, Mollusques, Moutarde, Graines de Sésame, Sulfites."
                },
                "Authority": {
                    "Name": null,
                    "Iso3166Alpha2": null,
                    "Iso3166Alpha3": null,
                    "Iso3166NumericSpecified": false,
                    "Id": "bbf4846d-8400-43bb-944d-6021fda98225",
                    "IdSpecified": true
                },
                "IsUserOverridden": false,
                "Delimiter": null,
                "CreatedSpecified": false,
                "ModifiedSpecified": false,
                "IdSpecified": false
            }
        ],
        "AllergenStatementsSpecified": true,
        "IngredientStatements": [
            {
                "ItemsSpecified": false,
                "Text": {
                    "en-US": "INGREDIENTS: Ingredient Common Name.",
                    "es-MX": "INGREDIENTES: Ingredient Common Name.",
                    "fr-CA": "INGRÉDIENTS: Ingredient Common Name."
                },
                "Authority": {
                    "Name": null,
                    "Iso3166Alpha2": null,
                    "Iso3166Alpha3": null,
                    "Iso3166NumericSpecified": false,
                    "Id": "bbf4846d-8400-43bb-944d-6021fda98225",
                    "IdSpecified": true
                },
                "IsUserOverridden": false,
                "Delimiter": null,
                "CreatedSpecified": false,
                "ModifiedSpecified": false,
                "IdSpecified": false
            }
        ],
        "IngredientStatementsSpecified": true,
        "Brand": {
            "Supplier": "Api Supplier",
            "Product": "Api Product",
            "IdSpecified": false
        },
        "GroupsIds": [
            "6748e1fb-0191-0000-1900-705b14f8f910",
            "6748e1fb-0192-0000-1900-705b14f8f910",
            "6748e1fb-0193-0000-1900-705b14f8f910",
            "6748e1fb-0194-0000-1900-705b14f8f910",
            "6748e1fb-0195-0000-1900-705b14f8f910",
            "6748e1fb-0196-0000-1900-705b14f8f910",
            "6748e1fb-0197-0000-1900-705b14f8f910",
            "6748e1fb-0198-0000-1900-705b14f8f910",
            "6748e1fb-0199-0000-1900-705b14f8f910",
            "6748e1fb-019a-0000-1900-705b14f8f910",
            "6748e1fb-019b-0000-1900-705b14f8f910",
            "6748e1fb-019c-0000-1900-705b14f8f910",
            "6748e1fb-019d-0000-1900-705b14f8f910",
            "6748e1fb-019e-0000-1900-705b14f8f910",
            "6748e1fb-019f-0000-1900-705b14f8f910",
            "6748e1fb-01a0-0000-1900-705b14f8f910"
        ],
        "GroupsIdsSpecified": true,
        "NutrientTransformIdsSpecified": false,
        "ImagesSpecified": false,
        "LabelsSpecified": false,
        "AnalysisOverrides": null,
        "PropertyValues": null,
        "Id": "8980ff36-f881-276d-5ef8-ee69ecb67fee",
        "IdSpecified": true
    },
    "FoodItems": null,
    "NutrientProfile": null,
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}