NewFood (3.1)
Owned by Nate Edwards
Summary: Creates new foods with the Food instances provided.
Soap Action: http://ns.esha.com/2013/genesisapi/NewFood
Request Type: NewFoodRequest
- Foods
- Type: FoodDto[]
- The foods to be created. These foods do not require an Id value. If an Ingredient is specified, a NutrientProfile needs to be provided and the NutrientProfileId must be specified on the Ingredient.
- The NutrientProfileId must be specified if an Ingredient.
- NutrientProfiles
- Type: NutrientProfileDto[]
- The nutrient profiles associated to Ingredients belonging in Foods. The Id value on this type must be specified.
Response Type: NewFoodResponse
- AddedFoodsCount
- Type: Int
- The number of newly created foods.
- Foods
- Type: FoodDto[]
- The newly created foods with Id values filled in.
- Errors
- Error[]
- Gives error information on the foods not created.
- Status
- Type: exlx:ResultStatus
- The ResultStatus of the given response
- ResponseVersion
- Type: exlx:XmlVersion
- The version of the given response.
SOAP Request (Ingredient) Expand source
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:gen="http://ns.esha.com/2013/genesisapi" xmlns:exlx="http://ns.esha.com/2013/exlx" xmlns:typ="http://ns.esha.com/2013/types"> <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://ns.esha.com/2013/genesisapi/newfood</wsa:Action></soap:Header> <soap:Body> <gen:NewFoodRequest> <gen:Foods> <gen:Ingredient> <exlx:Name> <typ:Value xml:lang="en-US">D-Xylose</typ:Value> </exlx:Name> <exlx:CommonName> <typ:Value xml:lang="en-US">Xylose</typ:Value> </exlx:CommonName> <exlx:Description> <typ:Value xml:lang="en-US">Used as a sugar substitute.</typ:Value> </exlx:Description> <exlx:UserCode>12345-XYLOSE</exlx:UserCode> <exlx:DefiningAmount> <exlx:Quantity Type="Double">100</exlx:Quantity> <exlx:UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:UnitId> </exlx:DefiningAmount> <exlx:DefaultWeightUnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:DefaultWeightUnitId> <exlx:Brand> <exlx:Supplier>Am Sweeteners - Middlesex</exlx:Supplier> <exlx:Product>D-Xylose</exlx:Product> </exlx:Brand> <exlx:AllergenStatements> <exlx:AllergenStatement> <exlx:AllergenGroups> <!-- Subscribe to Allerens --> <exlx:Id>f01975c0-0191-0000-ff88-2a01e505d63d</exlx:Id> </exlx:AllergenGroups> </exlx:AllergenStatement> </exlx:AllergenStatements> <exlx:Groups> <!-- Subscribe to Group --> <exlx:Id>021c021f-000a-0000-8d69-0b60293379ea</exlx:Id> </exlx:Groups> <exlx:AmountCost> <exlx:Amount> <exlx:Quantity Type="Double">100</exlx:Quantity> <exlx:UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:UnitId> </exlx:Amount> <exlx:Cost>10</exlx:Cost> </exlx:AmountCost> <exlx:NutrientProfileId>a7df0af5-0000-0000-7484-751e8eaf05c6</exlx:NutrientProfileId> </gen:Ingredient> </gen:Foods> <gen:NutrientProfiles> <gen:NutrientProfile> <exlx:Id>a7df0af5-0000-0000-7484-751e8eaf05c6</exlx:Id> <exlx:DefiningAmount> <exlx:Quantity Type="Double">100</exlx:Quantity> <exlx:UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:UnitId> </exlx:DefiningAmount> <exlx:NutrientIdVector> <exlx:Entry> <!-- Set Calories to 4 --> <exlx:NutrientId>84a8709a-0000-0000-ebf9-90cea7d9d44f</exlx:NutrientId> <exlx:Quantity Type="Double">4</exlx:Quantity> </exlx:Entry> <exlx:Entry> <!-- Set Protein to 1 --> <exlx:NutrientId>84a8709a-0001-0000-ebf9-90cea7d9d44f</exlx:NutrientId> <exlx:Quantity Type="Double">1</exlx:Quantity> </exlx:Entry> </exlx:NutrientIdVector> </gen:NutrientProfile> </gen:NutrientProfiles> </gen:NewFoodRequest> </soap:Body> </soap:Envelope>
SOAP Response (Ingredient) 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/newfoodresponse</a:Action> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <NewFoodResponse xmlns="http://ns.esha.com/2013/genesisapi"> <AddedFoodsCount>1</AddedFoodsCount> <Errors/> <Foods> <Ingredient> <Id xmlns="http://ns.esha.com/2013/exlx">752eb9c2-bff0-3a47-bede-d3a51c0fdeba</Id> <Name xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">D-Xylose</Value> </Name> <CommonName xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Xylose</Value> </CommonName> <Description xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Used as a sugar substitute.</Value> </Description> <DefiningAmount xmlns="http://ns.esha.com/2013/exlx"> <Quantity Type="Double">100</Quantity> <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId> </DefiningAmount> <AmountCost xmlns="http://ns.esha.com/2013/exlx"> <Amount> <Quantity Type="Double">100</Quantity> <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId> </Amount> <Cost>10</Cost> </AmountCost> <DefaultWeightUnitId xmlns="http://ns.esha.com/2013/exlx">a7df0af5-0008-0000-7484-751e8eaf05c6</DefaultWeightUnitId> <Conversions xmlns="http://ns.esha.com/2013/exlx"/> <UserCode xmlns="http://ns.esha.com/2013/exlx">12345-XYLOSE</UserCode> <AllergenStatements xmlns="http://ns.esha.com/2013/exlx"> <AllergenStatement> <IsUserOverridden>false</IsUserOverridden> <AllergenGroups> <Id>f01975c0-0191-0000-ff88-2a01e505d63d</Id> </AllergenGroups> </AllergenStatement> </AllergenStatements> <Brand xmlns="http://ns.esha.com/2013/exlx"> <Supplier>Am Sweeteners - Middlesex</Supplier> <Product>D-Xylose</Product> </Brand> <Groups xmlns="http://ns.esha.com/2013/exlx"> <Id>021c021f-000a-0000-8d69-0b60293379ea</Id> </Groups> </Ingredient> </Foods> <ResponseVersion>1.0.0.0</ResponseVersion> <Status> <StatusMessage>Ok</StatusMessage> <StatusCode>200</StatusCode> </Status> </NewFoodResponse> </s:Body> </s:Envelope>
SOAP Request (Recipe) Expand source
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:gen="http://ns.esha.com/2013/genesisapi" xmlns:exlx="http://ns.esha.com/2013/exlx" xmlns:typ="http://ns.esha.com/2013/types"> <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://ns.esha.com/2013/genesisapi/newfood</wsa:Action></soap:Header> <soap:Body> <gen:NewFoodRequest> <gen:Foods> <gen:Recipe> <exlx:Name> <typ:Value xml:lang="en-US">Sugar Recipe</typ:Value> </exlx:Name> <exlx:CommonName> <typ:Value xml:lang="en-US">Xylose</typ:Value> </exlx:CommonName> <exlx:Description> <typ:Value xml:lang="en-US">Used as a sugar substitute.</typ:Value> </exlx:Description> <exlx:UserCode>12345-XYLOSEREC</exlx:UserCode> <exlx:DefaultWeightUnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:DefaultWeightUnitId> <exlx:Brand> <exlx:Supplier>Am Sweeteners - Middlesex</exlx:Supplier> <exlx:Product>D-Xylose</exlx:Product> </exlx:Brand> <exlx:AllergenStatements> <exlx:AllergenStatement> <exlx:AllergenGroups> <!-- Subscribe to Allerens --> <exlx:Id>f01975c0-0191-0000-ff88-2a01e505d63d</exlx:Id> </exlx:AllergenGroups> </exlx:AllergenStatement> </exlx:AllergenStatements> <exlx:Groups> <!-- Subscribe to Group --> <exlx:Id>021c021f-000a-0000-8d69-0b60293379ea</exlx:Id> </exlx:Groups> <exlx:AmountCost> <exlx:Amount> <exlx:Quantity Type="Double">100</exlx:Quantity> <exlx:UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:UnitId> </exlx:Amount> <exlx:Cost>10</exlx:Cost> </exlx:AmountCost> <exlx:Items> <exlx:FoodItem> <!-- Add item to Recipe --> <exlx:FoodId>752eb9c2-dbed-7d82-bede-d3a51c0fdeba</exlx:FoodId> <exlx:Amount> <exlx:Quantity Type="Double">100</exlx:Quantity> <exlx:UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:UnitId> </exlx:Amount> </exlx:FoodItem> </exlx:Items> </gen:Recipe> </gen:Foods> </gen:NewFoodRequest> </soap:Body> </soap:Envelope>
SOAP Response (Recipe) 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/newfoodresponse</a:Action> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <NewFoodResponse xmlns="http://ns.esha.com/2013/genesisapi"> <AddedFoodsCount>1</AddedFoodsCount> <Errors/> <Foods> <Recipe> <Id xmlns="http://ns.esha.com/2013/exlx">8980ff36-fefc-5dcf-5ef8-ee69ecb67fee</Id> <Name xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Sugar Recipe</Value> </Name> <CommonName xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Xylose</Value> </CommonName> <Description xmlns="http://ns.esha.com/2013/exlx"> <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Used as a sugar substitute.</Value> </Description> <AmountCost xmlns="http://ns.esha.com/2013/exlx"> <Amount> <Quantity Type="Double">100</Quantity> <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId> </Amount> <Cost>10</Cost> </AmountCost> <DefaultWeightUnitId xmlns="http://ns.esha.com/2013/exlx">a7df0af5-0008-0000-7484-751e8eaf05c6</DefaultWeightUnitId> <Conversions xmlns="http://ns.esha.com/2013/exlx"/> <Items xmlns="http://ns.esha.com/2013/exlx"> <FoodItem> <FoodId>752eb9c2-dbed-7d82-bede-d3a51c0fdeba</FoodId> <Amount> <Quantity Type="Double">100</Quantity> <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId> </Amount> </FoodItem> </Items> <UserCode xmlns="http://ns.esha.com/2013/exlx">12345-XYLOSEREC</UserCode> <AllergenStatements xmlns="http://ns.esha.com/2013/exlx"> <AllergenStatement> <IsUserOverridden>false</IsUserOverridden> <AllergenGroups> <Id>f01975c0-0191-0000-ff88-2a01e505d63d</Id> </AllergenGroups> </AllergenStatement> </AllergenStatements> <Brand xmlns="http://ns.esha.com/2013/exlx"> <Supplier>Am Sweeteners - Middlesex</Supplier> <Product>D-Xylose</Product> </Brand> <Groups xmlns="http://ns.esha.com/2013/exlx"> <Id>021c021f-000a-0000-8d69-0b60293379ea</Id> </Groups> </Recipe> </Foods> <ResponseVersion>1.0.0.0</ResponseVersion> <Status> <StatusMessage>Ok</StatusMessage> <StatusCode>200</StatusCode> </Status> </NewFoodResponse> </s:Body> </s:Envelope>
REST Request (Ingredient) Expand source
PUT http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1 Content-Type: text/plain Host: localhost:80 request={ "Foods":[{ "$type":"Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization", "Name":{"en-US":"New Ingredient"}, "CommonName":{"en-US":"New Ingredient Common Name"}, "UserCode":"xyz-12", "Brand":{ "Supplier":"Am Sweeteners - Middlesex", "Product":"Product X" }, "DefiningAmount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "AllergenStatements":[{ "AllergenGroupIds":[ "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307", ] }], "GroupsIds":[ "021c021f-000a-0000-8d69-0b60293379ea" ], "AmountCost":{ "Amount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost":"5" }, "NutrientProfileId":"b6fa0af5-0008-0000-7484-751e8eaf05c6" }], "NutrientProfiles":[ { "Id":"b6fa0af5-0008-0000-7484-751e8eaf05c6", "DefiningAmount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "NutrientIdVector":[ { "NutrientId":"84a8709a-0000-0000-ebf9-90cea7d9d44f", "Quantity":{ "Type":"Double", "Value":4 }, }, { "NutrientId":"84a8709a-0001-0000-ebf9-90cea7d9d44f", "Quantity":{ "Type":"Double", "Value":1 }, } ] } ] }
REST Response (Ingredient) Expand source
{ "AddedFoodsCount": 1, "Foods": [ { "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization", "NutrientProfileId": "b6fa0af5-0008-0000-7484-751e8eaf05c6", "NutrientProfileIdSpecified": true, "FoodType": 73, "Name": { "en-US": "New Ingredient" }, "CommonName": { "en-US": "New Ingredient Common Name" }, "Description": null, "Notes": null, "DefiningAmount": { "Quantity": { "Value": "100", "Type": 14 }, "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6" }, "AmountCost": { "Amount": { "Quantity": { "Value": "100", "Type": 14 }, "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost": 5 }, "DefaultWeightUnitIdSpecified": false, "ConversionMapIdSpecified": false, "Conversions": null, "ItemsSpecified": false, "AnalysesSpecified": false, "GlycemicIndex": null, "CreatedSpecified": false, "ModifiedSpecified": false, "LegacyKeySpecified": false, "LegacyNutrientRefNumSpecified": false, "LegacyYieldKeySpecified": false, "UserCode": "xyz-12", "UsdaCodeSpecified": false, "EshaCodeSpecified": false, "OwnerName": null, "AlternateNamesSpecified": false, "AllergenStatementSettingsSpecified": false, "IngredientStatementSettingsSpecified": false, "AllergenStatements": [ { "AllergenGroupIds": [ "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307" ], "Text": null, "Authority": null, "IsUserOverridden": false, "Delimiter": null, "CreatedSpecified": false, "ModifiedSpecified": false, "IdSpecified": false } ], "AllergenStatementsSpecified": true, "IngredientStatementsSpecified": false, "Brand": { "Supplier": "Am Sweeteners - Middlesex", "Product": "Product X", "IdSpecified": false }, "GroupsIds": [ "021c021f-000a-0000-8d69-0b60293379ea" ], "GroupsIdsSpecified": true, "NutrientTransformIdsSpecified": false, "ImagesSpecified": false, "LabelsSpecified": false, "AnalysisOverrides": null, "PropertyValues": null, "Id": "752eb9c2-aa4e-7842-bede-d3a51c0fdeba", "IdSpecified": true } ], "Errors": [], "Status": { "StatusMessage": 200, "StatusCode": 200, "StatusDetail": null }, "ResponseVersion": {} }
REST Request (Recipe) Expand source
PUT http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1 Content-Type: text/plain Host: localhost:80 request={ "Foods":[{ "$type":"Esha.DomainModel.Serialization.RecipeDto, Esha.DomainModel.Serialization", "Name":{"en-US":"New Recipe"}, "CommonName":{"en-US":"New Recipe Common Name"}, "UserCode":"REC-987", "Brand":{ "Supplier":"Am Sweeteners - Middlesex", "Product":"Product X" }, "AllergenStatements":[{ "AllergenGroupIds":[ "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307", ] }], "GroupsIds":[ "021c021f-000a-0000-8d69-0b60293379ea" ], "AmountCost":{ "Amount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost":"5" }, "Items":[{ "FoodId":"752eb9c2-aa4e-7842-bede-d3a51c0fdeba", "Amount":{ "Quantity":{ "Value":"100","Type":"Double" }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"} }] }] }
REST Response (Recipe) Expand source
{ "AddedFoodsCount": 1, "Foods": [ { "$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": "New Recipe" }, "CommonName": { "en-US": "New Recipe Common Name" }, "Description": null, "Notes": null, "DefiningAmount": null, "AmountCost": { "Amount": { "Quantity": { "Value": "100", "Type": 14 }, "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost": 5 }, "DefaultWeightUnitIdSpecified": false, "ConversionMapIdSpecified": false, "Conversions": null, "Items": [ { "FoodId": "752eb9c2-aa4e-7842-bede-d3a51c0fdeba", "Amount": { "Quantity": { "Value": "100", "Type": 14 }, "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Note": null } ], "ItemsSpecified": true, "AnalysesSpecified": false, "GlycemicIndex": null, "CreatedSpecified": false, "ModifiedSpecified": false, "LegacyKeySpecified": false, "LegacyNutrientRefNumSpecified": false, "LegacyYieldKeySpecified": false, "UserCode": "REC-987", "UsdaCodeSpecified": false, "EshaCodeSpecified": false, "OwnerName": null, "AlternateNamesSpecified": false, "AllergenStatementSettingsSpecified": false, "IngredientStatementSettingsSpecified": false, "AllergenStatements": [ { "AllergenGroupIds": [ "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307" ], "Text": null, "Authority": null, "IsUserOverridden": false, "Delimiter": null, "CreatedSpecified": false, "ModifiedSpecified": false, "IdSpecified": false } ], "AllergenStatementsSpecified": true, "IngredientStatementsSpecified": false, "Brand": { "Supplier": "Am Sweeteners - Middlesex", "Product": "Product X", "IdSpecified": false }, "GroupsIds": [ "021c021f-000a-0000-8d69-0b60293379ea" ], "GroupsIdsSpecified": true, "NutrientTransformIdsSpecified": false, "ImagesSpecified": false, "LabelsSpecified": false, "AnalysisOverrides": null, "PropertyValues": null, "Id": "8980ff36-cd1b-2c23-5ef8-ee69ecb67fee", "IdSpecified": true } ], "Errors": [], "Status": { "StatusMessage": 200, "StatusCode": 200, "StatusDetail": null }, "ResponseVersion": {} }