/
ListFoods
ListFoods
Nate Edwards
Patrick Murphy
Alex Caroline
Owned by Nate Edwards
Last updated: Jul 13, 2020 by Patrick Murphy
Summary: Provides a list of all foods which match the criterion in the request.
Soap Action: http://ns.esha.com/2013/genesisapi/ListFoods
Request Type: FoodsListRequest
- FilterByFoodTypes (Optional)
- FoodType[]
- Indicates which types of foods are returned. If empty, all foods are returned.
- FilterByPublicationStates (Optional)
- PublicationState[]
- Indicates which foods with the given publication states are returned. If empty, only published 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 Expand source
<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:FoodsListRequest> <gen:FilterByPublicationStates> <gen:PublicationState>Draft</gen:PublicationState> <gen:PublicationState>Published</gen:PublicationState> </gen:FilterByPublicationStates> <gen:FilterByFoodTypes> <gen:FoodType>Ingredient</gen:FoodType> <gen:FoodType>Recipe</gen:FoodType> </gen:FilterByFoodTypes> <gen:DataSourceFilter> <gen:DataSource>EshaFoods</gen:DataSource> <gen:DataSource>UserFoods</gen:DataSource> </gen:DataSourceFilter> <gen:StartIndex>1</gen:StartIndex> <gen:PageSize>3</gen:PageSize> </gen:FoodsListRequest> </soap:Body> </soap:Envelope>
SOAP Response Expand source
<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/listfoodsresponse</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-0001-0000-bede-d3a51c0fdeba</Id> <Name xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">milk, whole, 3.25%, with vitamin D</Value> </Name> <Created xmlns="http://ns.esha.com/2013/exlx"> <DateTime xmlns="http://ns.esha.com/2013/types">1999-03-20T08:00:00.0000000</DateTime> <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">-480</UtcOffsetInMinutes> </Created> <Modified xmlns="http://ns.esha.com/2013/exlx"> <DateTime xmlns="http://ns.esha.com/2013/types">1999-03-20T08:00:00.0000000</DateTime> <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">-480</UtcOffsetInMinutes> </Modified> </Ingredient> <Ingredient> <Id xmlns="http://ns.esha.com/2013/exlx">752eb9c2-0002-0000-bede-d3a51c0fdeba</Id> <Name xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">milk, 2%, with vitamins A & D</Value> </Name> <Created xmlns="http://ns.esha.com/2013/exlx"> <DateTime xmlns="http://ns.esha.com/2013/types">1999-03-20T08:00:00.0000000</DateTime> <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">-480</UtcOffsetInMinutes> </Created> <Modified xmlns="http://ns.esha.com/2013/exlx"> <DateTime xmlns="http://ns.esha.com/2013/types">2018-08-15T04:06:00.0000000</DateTime> <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">-420</UtcOffsetInMinutes> </Modified> </Ingredient> <Ingredient> <Id xmlns="http://ns.esha.com/2013/exlx">752eb9c2-0004-0000-bede-d3a51c0fdeba</Id> <Name xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">milk, 1%, with vitamins A & D</Value> </Name> <Created xmlns="http://ns.esha.com/2013/exlx"> <DateTime xmlns="http://ns.esha.com/2013/types">1999-03-20T08:00:00.0000000</DateTime> <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">-480</UtcOffsetInMinutes> </Created> <Modified xmlns="http://ns.esha.com/2013/exlx"> <DateTime xmlns="http://ns.esha.com/2013/types">2018-08-15T04:11:00.0000000</DateTime> <UtcOffsetInMinutes xmlns="http://ns.esha.com/2013/types">-420</UtcOffsetInMinutes> </Modified> </Ingredient> </Foods> <ResponseVersion>1.0.0.0</ResponseVersion> <Status> <StatusMessage>Ok</StatusMessage> <StatusCode>200</StatusCode> </Status> </FoodsListResponse> </s:Body> </s:Envelope>
REST Request Expand source
POST http://localhost:80/rest/FoodQueryService.svc/ListFoods HTTP/1.1 Content-Type: text/plain Host: localhost:80 request={"StartIndex":1, "PageSize":3, "FilterByPublicationStates":["Draft","Published"], "FilterByFoodTypes":["Ingredient", "Recipe"], "DataSourceFilter":["UserFoods", "EshaFoods"]}
REST Response Expand source
{ "Foods": [ { "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization", "NutrientProfileIdSpecified": false, "FoodType": 73, "Name": { "en-US": "milk, whole, 3.25%, with vitamin D" }, "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-20T08:00:00.0000000", "UtcOffsetInMinutes": -480 }, "CreatedSpecified": true, "Modified": { "DateTime": "1999-03-20T08:00:00.0000000", "UtcOffsetInMinutes": -480 }, "ModifiedSpecified": true, "LegacyKeySpecified": false, "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-0001-0000-bede-d3a51c0fdeba", "IdSpecified": true }, { "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization", "NutrientProfileIdSpecified": false, "FoodType": 73, "Name": { "en-US": "milk, 2%, with vitamins A & D" }, "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-20T08:00:00.0000000", "UtcOffsetInMinutes": -480 }, "CreatedSpecified": true, "Modified": { "DateTime": "2018-08-15T04:06:00.0000000", "UtcOffsetInMinutes": -420 }, "ModifiedSpecified": true, "LegacyKeySpecified": false, "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-0002-0000-bede-d3a51c0fdeba", "IdSpecified": true }, { "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization", "NutrientProfileIdSpecified": false, "FoodType": 73, "Name": { "en-US": "milk, 1%, with vitamins A & D" }, "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-20T08:00:00.0000000", "UtcOffsetInMinutes": -480 }, "CreatedSpecified": true, "Modified": { "DateTime": "2018-08-15T04:11:00.0000000", "UtcOffsetInMinutes": -420 }, "ModifiedSpecified": true, "LegacyKeySpecified": false, "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-0004-0000-bede-d3a51c0fdeba", "IdSpecified": true } ], "Status": { "StatusMessage": 200, "StatusCode": 200, "StatusDetail": null }, "ResponseVersion": {} }
, multiple selections available,
Related content
Genesis Classic API 4.x References
Genesis Classic API 4.x References
Read with this
NewFood (4.0)
NewFood (4.0)
More like this
Getting started with Genesis API
Getting started with Genesis API
Read with this
UpdateFood (4.0)
UpdateFood (4.0)
More like this
GetFoodByFoodId
GetFoodByFoodId
Read with this
Genesis API Frequently Asked Questions
Genesis API Frequently Asked Questions
More like this