Search

Summary: ­Search foods by what is specified in the request.

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

Request Type: FoodsSearchRequest

  • SearchText
    • Type: String
    • The text to search for.
  • FilterByFoodTypes (Optional)
    • FoodType[]
    • Indicates which types of foods are returned. If empty, all foods are returned.
  • FilterByPulbicationStates (Optional)
    • PublicationState[]
    • Indicates which foods with the given publication states are returned. If empty, all foods are returned.
  • DataSourceFilter (Optional)
    • String[]
    • Indicates which sources (UserFoods / EshaFoods) to query from.  
  • 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:FoodsSearchRequest>
         <gen:DataSourceFilter>
            <gen:DataSource>UserFoods</gen:DataSource>
            <gen:DataSource>EshaFoods</gen:DataSource>
         </gen:DataSourceFilter>
         <gen:FilterByFoodTypes>
            <gen:FoodType>Recipe</gen:FoodType>
		  <gen:FoodType>Ingredient</gen:FoodType>
         </gen:FilterByFoodTypes>
         <gen:FilterByPublicationStates>
            <gen:PublicationState>Draft</gen:PublicationState>
            <gen:PublicationState>Published</gen:PublicationState>
         </gen:FilterByPublicationStates>
         <gen:PageSize>3</gen:PageSize>
         <gen:SearchText>chicken</gen:SearchText>
         <gen:StartIndex>1</gen:StartIndex>
      </gen:FoodsSearchRequest>
   </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/searchresponse</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-c4a7-0000-bede-d3a51c0fdeba</Id>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">broth, chicken, canned</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">2016-06-09T23:28:00.0000000</DateTime>
                  <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
               </Modified>
               <LegacyKey xmlns="http://ns.esha.com/2013/exlx">50343</LegacyKey>
               <Brand xmlns="http://ns.esha.com/2013/exlx">
                  <Supplier>Del Monte Foods Company</Supplier>
                  <Product>College Inn</Product>
               </Brand>
            </Ingredient>
            <Ingredient>
               <Id xmlns="http://ns.esha.com/2013/exlx">752eb9c2-ef6a-72c7-bede-d3a51c0fdeba</Id>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Chicken Broccoli Seasoning</Value>
               </Name>
               <Created xmlns="http://ns.esha.com/2013/exlx">
                  <DateTime xmlns="http://ns.esha.com/2013/types">2012-05-02T07: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">2012-05-02T07:00:00.0000000</DateTime>
                  <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
               </Modified>
               <LegacyKey xmlns="http://ns.esha.com/2013/exlx">1925705578</LegacyKey>
            </Ingredient>
            <Recipe>
               <Id xmlns="http://ns.esha.com/2013/exlx">8980ff36-31be-711a-5ef8-ee69ecb67fee</Id>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">chicken soup</Value>
               </Name>
               <CommonName xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">SLARK</Value>
               </CommonName>
               <Created xmlns="http://ns.esha.com/2013/exlx">
                  <DateTime xmlns="http://ns.esha.com/2013/types">2015-10-15T20:05: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-04T15:49:00.0000000</DateTime>
                  <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">0</UtcOffsetInMinutes>
               </Modified>
               <LegacyKey xmlns="http://ns.esha.com/2013/exlx">1897542078</LegacyKey>
               <UserCode xmlns="http://ns.esha.com/2013/exlx">0032-000</UserCode>
            </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/Search HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={"SearchText":"chicken", "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": "broth, chicken, canned"
            },
            "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": "2016-06-09T23:28:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "ModifiedSpecified": true,
            "LegacyKey": 50343,
            "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": "Del Monte Foods Company",
                "Product": "College Inn",
                "IdSpecified": false
            },
            "GroupsIdsSpecified": false,
            "NutrientTransformIdsSpecified": false,
            "ImagesSpecified": false,
            "LabelsSpecified": false,
            "AnalysisOverrides": null,
            "PropertyValues": null,
            "Id": "752eb9c2-c4a7-0000-bede-d3a51c0fdeba",
            "IdSpecified": true
        },
        {
            "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization",
            "NutrientProfileIdSpecified": false,
            "FoodType": 73,
            "Name": {
                "en-US": "Chicken Broccoli Seasoning"
            },
            "CommonName": null,
            "Description": null,
            "Notes": null,
            "DefiningAmount": null,
            "AmountCost": null,
            "DefaultWeightUnitIdSpecified": false,
            "ConversionMapIdSpecified": false,
            "Conversions": null,
            "ItemsSpecified": false,
            "AnalysesSpecified": false,
            "GlycemicIndex": null,
            "Created": {
                "DateTime": "2012-05-02T07:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "CreatedSpecified": true,
            "Modified": {
                "DateTime": "2012-05-02T07:00:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "ModifiedSpecified": true,
            "LegacyKey": 1925705578,
            "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": "752eb9c2-ef6a-72c7-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": "chicken soup"
            },
            "CommonName": {
                "en-US": "SLARK"
            },
            "Description": null,
            "Notes": null,
            "DefiningAmount": null,
            "AmountCost": null,
            "DefaultWeightUnitIdSpecified": false,
            "ConversionMapIdSpecified": false,
            "Conversions": null,
            "ItemsSpecified": false,
            "AnalysesSpecified": false,
            "GlycemicIndex": null,
            "Created": {
                "DateTime": "2015-10-15T20:05:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "CreatedSpecified": true,
            "Modified": {
                "DateTime": "2018-08-04T15:49:00.0000000",
                "UtcOffsetInMinutes": 0
            },
            "ModifiedSpecified": true,
            "LegacyKey": 1897542078,
            "LegacyKeySpecified": true,
            "LegacyNutrientRefNumSpecified": false,
            "LegacyYieldKeySpecified": false,
            "UserCode": "0032-000",
            "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-31be-711a-5ef8-ee69ecb67fee",
            "IdSpecified": true
        }
    ],
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}