SearchByName

Summary: Searches published foods returning those which case-insensitively match the supplied name, or which contain a food with the name.

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

Request Type: FoodsByNameRequest

  • FoodName
    • Type: String
    • The name of the foods to search for
  • FilterByFoodTypes (Optional)
    • FoodType[]
    • Indicates which types of foods are returned. If empty, all foods are returned.
  • DataSourceFilter (Optional)
    • String[]
    • Indicates which sources (UserFoods / EshaFoods) to query from.
  • FilterByPulbicationStates (Optional)
    • PublicationState[]
    • Indicates which foods with the given publication states are returned. If empty, all foods are returned.
  • StartIndex (Optional)
    • Type: Int
    • The index offset. If empty, index starts at 1.
  • PageSize (Optional)
    • Type: Int
    • The number of foods to return in the response. If empty, all records are returned.

Response Type: FoodsListResponse

  • Foods
    • Type: FoodDto[]
    • The list of foods obtained from the request.
  • 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:FoodsByNameRequest>
         <gen:FilterByFoodTypes>
            <gen:FoodType>Ingredient</gen:FoodType>
            <gen:FoodType>Recipe</gen:FoodType>
         </gen:FilterByFoodTypes>
         <gen:FilterByPublicationStates>
            <gen:PublicationState>Draft</gen:PublicationState>
            <gen:PublicationState>Published</gen:PublicationState>
         </gen:FilterByPublicationStates>
         <gen:DataSourceFilter>
            <gen:DataSource>UserFoods</gen:DataSource>
            <gen:DataSource>EshaFoods</gen:DataSource>
         </gen:DataSourceFilter>
         <gen:FoodName>Pizza</gen:FoodName>
         <gen:PageSize>3</gen:PageSize>
         <gen:StartIndex>1</gen:StartIndex>
      </gen:FoodsByNameRequest>
   </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/searchbynameresponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <FoodsListResponse xmlns="http://ns.esha.com/2013/genesisapi">
         <Foods>
            <Ingredient>
               <Id xmlns="http://ns.esha.com/2013/exlx">752eb9c2-4519-0000-bede-d3a51c0fdeba</Id>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">pizza roll, sausage, frozen</Value>
               </Name>
               <Created xmlns="http://ns.esha.com/2013/exlx">
                  <DateTime xmlns="http://ns.esha.com/2013/types">1999-03-20T00:00: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">1999-03-20T00:00:00.0000000</DateTime>
                  <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
               </Modified>
               <LegacyKey xmlns="http://ns.esha.com/2013/exlx">17689</LegacyKey>
               <Brand xmlns="http://ns.esha.com/2013/exlx">
                  <Supplier>General Mills</Supplier>
                  <Product>Totino's</Product>
               </Brand>
            </Ingredient>
            <Ingredient>
               <Id xmlns="http://ns.esha.com/2013/exlx">752eb9c2-686c-0000-bede-d3a51c0fdeba</Id>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">pizza crust</Value>
               </Name>
               <Created xmlns="http://ns.esha.com/2013/exlx">
                  <DateTime xmlns="http://ns.esha.com/2013/types">1999-03-20T00:00: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-18T15:40:00.0000000</DateTime>
                  <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
               </Modified>
               <LegacyKey xmlns="http://ns.esha.com/2013/exlx">26732</LegacyKey>
               <Brand xmlns="http://ns.esha.com/2013/exlx">
                  <Supplier>Whole Foods</Supplier>
                  <Product>Whole Foods</Product>
               </Brand>
            </Ingredient>
            <Recipe>
               <Id xmlns="http://ns.esha.com/2013/exlx">8980ff36-8a8c-0abd-5ef8-ee69ecb67fee</Id>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">650259 Sauce 3 Cheese Pizza UPDATE MG 112816</Value>
               </Name>
               <Created xmlns="http://ns.esha.com/2013/exlx">
                  <DateTime xmlns="http://ns.esha.com/2013/types">2016-11-28T08:00: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">2016-12-07T08:00:00.0000000</DateTime>
                  <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
               </Modified>
               <LegacyKey xmlns="http://ns.esha.com/2013/exlx">180193932</LegacyKey>
            </Recipe>
         </Foods>
         <ResponseVersion>1.0.0.0</ResponseVersion>
         <Status>
            <StatusMessage>Ok</StatusMessage>
            <StatusCode>200</StatusCode>
         </Status>
      </FoodsListResponse>
   </s:Body>
</s:Envelope>
REST Request
POST http://localhost:80/rest/FoodQueryService.svc/SearchByName HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={"FoodName":"pizza", "StartIndex":1, "PageSize":3, "FilterByPublicationStates":["Draft", "Published"],  "DataSourceFilter":["UserFoods", "EshaFoods"], "FilterByFoodTypes":["Ingredient", "Recipe"]}
REST Response
{
    "Foods": [
        {
            "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization",
            "NutrientProfileIdSpecified": false,
            "FoodType": 73,
            "Name": {
                "en-US": "pizza roll, sausage, frozen"
            },
            "CommonName": null,
            "Description": null,
            "Notes": null,
            "DefiningAmount": null,
            "AmountCost": null,
            "DefaultWeightUnitIdSpecified": false,
            "ConversionMapIdSpecified": false,
            "Conversions": null,
            "ItemsSpecified": false,
            "AnalysesSpecified": false,
            "GlycemicIndex": null,
            "Created": {
                "DateTime": "1999-03-20T00:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "CreatedSpecified": true,
            "Modified": {
                "DateTime": "1999-03-20T00:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "ModifiedSpecified": true,
            "LegacyKey": 17689,
            "LegacyKeySpecified": true,
            "LegacyNutrientRefNumSpecified": false,
            "LegacyYieldKeySpecified": false,
            "UserCode": null,
            "UsdaCodeSpecified": false,
            "EshaCodeSpecified": false,
            "OwnerName": null,
            "AlternateNamesSpecified": false,
            "AllergenStatementSettingsSpecified": false,
            "IngredientStatementSettingsSpecified": false,
            "AllergenStatementsSpecified": false,
            "IngredientStatementsSpecified": false,
            "Brand": {
                "Supplier": "General Mills",
                "Product": "Totino's",
                "IdSpecified": false
            },
            "GroupsIdsSpecified": false,
            "NutrientTransformIdsSpecified": false,
            "ImagesSpecified": false,
            "LabelsSpecified": false,
            "AnalysisOverrides": null,
            "PropertyValues": null,
            "Id": "752eb9c2-4519-0000-bede-d3a51c0fdeba",
            "IdSpecified": true
        },
        {
            "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization",
            "NutrientProfileIdSpecified": false,
            "FoodType": 73,
            "Name": {
                "en-US": "pizza crust"
            },
            "CommonName": null,
            "Description": null,
            "Notes": null,
            "DefiningAmount": null,
            "AmountCost": null,
            "DefaultWeightUnitIdSpecified": false,
            "ConversionMapIdSpecified": false,
            "Conversions": null,
            "ItemsSpecified": false,
            "AnalysesSpecified": false,
            "GlycemicIndex": null,
            "Created": {
                "DateTime": "1999-03-20T00:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "CreatedSpecified": true,
            "Modified": {
                "DateTime": "2018-08-18T15:40:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "ModifiedSpecified": true,
            "LegacyKey": 26732,
            "LegacyKeySpecified": true,
            "LegacyNutrientRefNumSpecified": false,
            "LegacyYieldKeySpecified": false,
            "UserCode": null,
            "UsdaCodeSpecified": false,
            "EshaCodeSpecified": false,
            "OwnerName": null,
            "AlternateNamesSpecified": false,
            "AllergenStatementSettingsSpecified": false,
            "IngredientStatementSettingsSpecified": false,
            "AllergenStatementsSpecified": false,
            "IngredientStatementsSpecified": false,
            "Brand": {
                "Supplier": "Whole Foods",
                "Product": "Whole Foods",
                "IdSpecified": false
            },
            "GroupsIdsSpecified": false,
            "NutrientTransformIdsSpecified": false,
            "ImagesSpecified": false,
            "LabelsSpecified": false,
            "AnalysisOverrides": null,
            "PropertyValues": null,
            "Id": "752eb9c2-686c-0000-bede-d3a51c0fdeba",
            "IdSpecified": true
        },
        {
            "$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": "650259 Sauce 3 Cheese Pizza UPDATE MG 112816"
            },
            "CommonName": null,
            "Description": null,
            "Notes": null,
            "DefiningAmount": null,
            "AmountCost": null,
            "DefaultWeightUnitIdSpecified": false,
            "ConversionMapIdSpecified": false,
            "Conversions": null,
            "ItemsSpecified": false,
            "AnalysesSpecified": false,
            "GlycemicIndex": null,
            "Created": {
                "DateTime": "2016-11-28T08:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "CreatedSpecified": true,
            "Modified": {
                "DateTime": "2016-12-07T08:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "ModifiedSpecified": true,
            "LegacyKey": 180193932,
            "LegacyKeySpecified": true,
            "LegacyNutrientRefNumSpecified": false,
            "LegacyYieldKeySpecified": false,
            "UserCode": null,
            "UsdaCodeSpecified": false,
            "EshaCodeSpecified": false,
            "OwnerName": null,
            "AlternateNamesSpecified": false,
            "AllergenStatementSettingsSpecified": false,
            "IngredientStatementSettingsSpecified": false,
            "AllergenStatementsSpecified": false,
            "IngredientStatementsSpecified": false,
            "Brand": null,
            "GroupsIdsSpecified": false,
            "NutrientTransformIdsSpecified": false,
            "ImagesSpecified": false,
            "LabelsSpecified": false,
            "AnalysisOverrides": null,
            "PropertyValues": null,
            "Id": "8980ff36-8a8c-0abd-5ef8-ee69ecb67fee",
            "IdSpecified": true
        }
    ],
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}