UpdateFood (4.0)
Owned by Alex Caroline
Summary: Updates existing foods with the FoodEdit instances provided.
Request Type: UpdateFoodRequest
- IngredientsEdits
- Type: IngredientsEditDto[]
- The ingredients to be created
- RecipeEdits
- Type: RecipeEditDto[]
- The recipes to be created
- CompositeIngredientEdits
- Type: CompositeIngredientEditDto[]
- The composite ingredients to be created
Response Type: UpdateFoodResponse
- UpdatedFoodsCount
- Type: Int
- The number of updated foods.
- Errors
- Error[]
- Gives error information on the foods not created.
- Status
- Type: exlx:ResultStatus
- The ResultStatus of the given response
- ResponseVersion
- Type: exlx:XmlVersion
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/> <soap:Body> <gen:UpdateFoodRequest> <gen:IngredientsEdits> <gen:IngredientsEdit> <exlx:NutrientProfile> <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> </exlx:NutrientProfile> <exlx:EditDetails> <exlx:EditMessage>Updating Ingredient</exlx:EditMessage> <exlx:EditCaller> <exlx:Name>Our PLM System</exlx:Name> </exlx:EditCaller> </exlx:EditDetails> <exlx:Ingredients> <exlx:Ingredient> <exlx:Id>752eb9c2-e240-0001-bede-d3a51c0fdeba</exlx:Id> <!-- Must be provided --> <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:IngredientStatementSettings> <!--Zero or more repetitions:--> <exlx:IngredientStatementSetting> <exlx:ItemsOverrideText> <!--1 or more repetitions:--> <typ:Value xml:lang="en-US">Item One, Item Two, Item Three</typ:Value> </exlx:ItemsOverrideText> <exlx:StatementNameOverride> <typ:Value xml:lang="en-US">Custom Ingredient Statement</typ:Value> </exlx:StatementNameOverride> <exlx:CompositionBehavior>Override</exlx:CompositionBehavior> </exlx:IngredientStatementSetting> </exlx:IngredientStatementSettings> <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:Ingredient> </exlx:Ingredients> </gen:IngredientsEdit> </gen:IngredientsEdits> </gen:UpdateFoodRequest> </soap:Body> </soap: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/> <soap:Body> <gen:UpdateFoodRequest> <gen:RecipeEdits> <gen:RecipeEdit> <exlx:LabelProfile> <exlx:Authority> <exlx:Id>BBF4846D-8400-43BB-944D-6021FDA98225</exlx:Id> <exlx:Regulation>U.S. 2016 NLEA</exlx:Regulation> </exlx:Authority> <exlx:LabelStyle>Standard</exlx:LabelStyle> <exlx:LabelFormat>Full</exlx:LabelFormat> <exlx:AlternateHeading> <typ:Value xml:lang="en-US">Sugar</typ:Value> </exlx:AlternateHeading> <exlx:ServingSize> <typ:Value xml:lang="en-US">1 scoop</typ:Value> </exlx:ServingSize> <exlx:ServingsPerContainer> <typ:Value xml:lang="en-US">1</typ:Value> </exlx:ServingsPerContainer> </exlx:LabelProfile> <exlx:EditDetails> <exlx:EditMessage>Updating Recipe</exlx:EditMessage> <exlx:EditCaller> <exlx:Name>Our PLM System</exlx:Name> </exlx:EditCaller> </exlx:EditDetails> <!--Optional:--> <exlx:Recipe> <exlx:Id>8980ff36-e240-0001-5ef8-ee69ecb67fee</exlx:Id> <!-- Must be provided --> <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:IngredientStatementSettings> <!--Zero or more repetitions:--> <exlx:IngredientStatementSetting> <exlx:ItemsOverrideText> <!--1 or more repetitions:--> <typ:Value xml:lang="en-US">Item One, Item Two, Item Three</typ:Value> </exlx:ItemsOverrideText> <exlx:StatementNameOverride> <typ:Value xml:lang="en-US">Custom Ingredient Statement</typ:Value> </exlx:StatementNameOverride> <exlx:CompositionBehavior>Override</exlx:CompositionBehavior> </exlx:IngredientStatementSetting> </exlx:IngredientStatementSettings> <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-0001-0000-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> </exlx:Recipe> </gen:RecipeEdit> </gen:RecipeEdits> </gen:UpdateFoodRequest> </soap:Body> </soap:Envelope>
SOAP Request (Composite 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/> <soap:Body> <gen:UpdateFoodRequest> <!--Optional:--> <gen:CompositeIngredientEdits> <!--Zero or more repetitions:--> <gen:CompositeIngredientEdit> <!--Optional:--> <exlx:CompositeIngredient> <exlx:Id>8980ff36-e240-0001-5ef8-ee69ecb67fee</exlx:Id> <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:IngredientStatementSettings> <!--Zero or more repetitions:--> <exlx:IngredientStatementSetting> <exlx:ItemsOverrideText> <!--1 or more repetitions:--> <typ:Value xml:lang="en-US">Item One, Item Two, Item Three</typ:Value> </exlx:ItemsOverrideText> <exlx:StatementNameOverride> <typ:Value xml:lang="en-US">Custom Ingredient Statement</typ:Value> </exlx:StatementNameOverride> <exlx:CompositionBehavior>Override</exlx:CompositionBehavior> </exlx:IngredientStatementSetting> </exlx:IngredientStatementSettings> <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-0001-0000-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> </exlx:CompositeIngredient> <!--Optional:--> <exlx:EditDetails> <!--Optional:--> <exlx:EditMessage>Updating Composite Ingredient</exlx:EditMessage> <!--Optional:--> <exlx:EditCaller> <!--Optional:--> <exlx:Name>Our PLM System</exlx:Name> </exlx:EditCaller> </exlx:EditDetails> </gen:CompositeIngredientEdit> </gen:CompositeIngredientEdits> </gen:UpdateFoodRequest> </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/updatefoodresponse</a:Action> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <UpdateFoodResponse xmlns="http://ns.esha.com/2013/genesisapi"> <UpdateFoodsCount>1</UpdateFoodsCount> <Errors/> <ResponseVersion>1.0.0.0</ResponseVersion> <Status> <StatusMessage>Ok</StatusMessage> <StatusCode>200</StatusCode> </Status> </UpdateFoodResponse> </s:Body> </s:Envelope>
REST Request (Ingredient) Expand source
POST http://localhost:80/rest/FoodEditService.svc/UpdateFood HTTP/1.1 Content-Type: text/plain Host: localhost:80 request={ "IngredientsEdits":[{ "Ingredients":[{ "Id":"752eb9c2-e240-0001-bede-d3a51c0fdeba", "Name":{"en-US":"Updated Ingredient Name"}, "CommonName":{"en-US":"Updated 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":[ "f01975c0-0191-0000-ff88-2a01e505d63d", ] }], "IngredientStatementSettings":[ { "ItemsOverrideText":{ "en-US":"Item One, Item Two, Item Three", "es-MX":"Artículo Uno, Artículo Dos, Artículo Tres", "fr-CA":"Article Un, Article Deux, Article Trois" }, "StatementNameOverride":{ "en-US":"Custom Ingredient Statement", "es-MX":"Declaración de ingredientes personalizada", "fr-CA":"Déclaration d'ingrédients personnalisée" }, "CompositionBehavior":"Override" } ], "GroupsIds":[ "6748e1fb-0002-0000-1900-705b14f8f910" ], "AmountCost":{ "Amount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost":"5" } }], "NutrientProfile":{ "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 }, } ] }, "EditDetails":{ "EditMessage":"Updating Ingredient", "EditCaller":{ "Name":"Our PLM System" } } }] }
REST Request (Recipe) Expand source
POST http://localhost:80/rest/FoodEditService.svc/UpdateFood HTTP/1.1 Content-Type: text/plain Host: localhost:80 request={ "RecipeEdits":[{ "Recipe":{ "Id":"8980ff36-e240-0001-5ef8-ee69ecb67fee", "Name":{"en-US":"Updated Recipe Name"}, "CommonName":{"en-US":"Updated Recipe Common Name"}, "UserCode":"REC-987", "Brand":{ "Supplier":"Am Sweeteners - Middlesex", "Product":"Product X" }, "AllergenStatements":[{ "AllergenGroupIds":[ "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307", ] }], "IngredientStatementSettings":[ { "ItemsOverrideText":{ "en-US":"Item One, Item Two, Item Three", "es-MX":"Artículo Uno, Artículo Dos, Artículo Tres", "fr-CA":"Article Un, Article Deux, Article Trois" }, "StatementNameOverride":{ "en-US":"Custom Ingredient Statement", "es-MX":"Declaración de ingredientes personalizada", "fr-CA":"Déclaration d'ingrédients personnalisée" }, "CompositionBehavior":"Override" } ], "GroupsIds":[ "021c021f-000a-0000-8d69-0b60293379ea" ], "AmountCost":{ "Amount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost":"5" }, "Items":[{ "FoodId":"752eb9c2-0001-0000-bede-d3a51c0fdeba", "Amount":{ "Quantity":{ "Value":"100","Type":"Double" }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"} }] }, "LabelProfile":{ "Authority":{ "Id":"BBF4846D-8400-43BB-944D-6021FDA98225", "Regulation":"U.S. 2016 NLEA" }, "LabelStyle":"Standard", "LabelFormat":"Full", "AlternateHeading":{"en-US":"Updated Heading"}, "ServingSize":{"en-US":"1"}, "ServingsPerContainer":{"en-US":"1"} }, "EditDetails":{ "EditMessage":"Updating Recipe", "EditCaller":{ "Name":"Our PLM System" } } }] }
REST Request (Composite Ingredient) Expand source
POST http://localhost:80/rest/FoodEditService.svc/UpdateFood HTTP/1.1 Content-Type: text/plain Host: localhost:80 request={ "CompositeIngredientEdits":[{ "CompositeIngredient":{ "Id":"8980ff36-e240-0001-5ef8-ee69ecb67fee", "Name":{"en-US":"Updated Comp Ing"}, "CommonName":{"en-US":"Updated CompIng Common Name"}, "UserCode":"REC-987", "Brand":{ "Supplier":"Am Sweeteners - Middlesex", "Product":"Product X" }, "AllergenStatements":[{ "AllergenGroupIds":[ "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307", ] }], "IngredientStatementSettings":[ { "ItemsOverrideText":{ "en-US":"Item One, Item Two, Item Three", "es-MX":"Artículo Uno, Artículo Dos, Artículo Tres", "fr-CA":"Article Un, Article Deux, Article Trois" }, "StatementNameOverride":{ "en-US":"Custom Ingredient Statement", "es-MX":"Declaración de ingredientes personalizada", "fr-CA":"Déclaration d'ingrédients personnalisée" }, "CompositionBehavior":"Override" } ], "GroupsIds":[ "021c021f-000a-0000-8d69-0b60293379ea" ], "AmountCost":{ "Amount":{ "Quantity":{ "Type":"Double", "Value":100 }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6" }, "Cost":"5" }, "Items":[{ "FoodId":"752eb9c2-0001-0000-bede-d3a51c0fdeba", "Amount":{ "Quantity":{ "Value":"100","Type":"Double" }, "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"} }] }, "EditDetails":{ "EditMessage":"Updating Composite Ingredient", "EditCaller":{ "Name":"Our PLM System" } } }] }
REST Response Expand source
{ "UpdatedFoodsCount": 1, "Errors": [], "Status": { "StatusMessage": 200, "StatusCode": 200, "StatusDetail": null }, "ResponseVersion": {} }