NewFood (4.0)

Summary: Creates new foods with the Food Edits provided.

Request Type: NewFoodRequest

  • 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: 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)
<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:NewFoodRequest>
         <gen:IngredientsEdits>
            <!--Zero or more repetitions:-->
            <gen:IngredientsEdit>
               <!--Optional:-->
               <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>Creating New Ingredient</exlx:EditMessage>
                  <exlx:EditCaller>
                     <exlx:Name>Our PLM System</exlx:Name>
                  </exlx:EditCaller>
               </exlx:EditDetails>
               <exlx:Ingredients>
                  <exlx: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: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:NewFoodRequest>
   </soap:Body>
</soap:Envelope>
SOAP Request (Recipe)
<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:NewFoodRequest>
         <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>Creating New Recipe</exlx:EditMessage>
                  <exlx:EditCaller>
                     <exlx:Name>Our PLM System</exlx:Name>
                  </exlx:EditCaller>
               </exlx:EditDetails>
               <!--Optional:-->
               <exlx: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: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:NewFoodRequest>
   </soap:Body>
</soap:Envelope>
SOAP Request (Composite Ingredient)
<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:NewFoodRequest>
         <!--Optional:-->
         <gen:CompositeIngredientEdits>
            <!--Zero or more repetitions:-->
            <gen:CompositeIngredientEdit>
               <!--Optional:-->
               <exlx:CompositeIngredient>
                 <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>Creating Composite Ingredient</exlx:EditMessage>
                  <!--Optional:-->
                  <exlx:EditCaller>
                     <!--Optional:-->
                     <exlx:Name>Our PLM System</exlx:Name>
                  </exlx:EditCaller>
               </exlx:EditDetails>
            </gen:CompositeIngredientEdit>
         </gen:CompositeIngredientEdits>
      </gen:NewFoodRequest>
   </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/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-fd2a-248b-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>
REST Request (Ingredient)
POST http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={
	"IngredientsEdits":[{
		"Ingredients":[{
			"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"
            },
// Conversions are used to set Measure conversions
//  here a Volume Measure is added to the Ingredient to reflect 1/2 cup = 127 grams
            "Conversions":[{
                "To":{
                    "Quantity":{
                        "Value":"127",
                        "Type":"Double"
                    },
                    "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"
                },
                "From":{
                    "Quantity":{
                        "Value":"0.5",
                        "Type":"Double"
                    },
                    "UnitId":"a7df0af5-0003-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":"Creating New Ingredient",
            "EditCaller":{
                "Name":"Our PLM System"
            }
        }
	}]
}
REST Request (Recipe)
POST http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={
	"RecipeEdits":[{
		"Recipe":{
			"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",
	            ]
	        }],
            "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"}
	        }],
// Conversions are used to set Measure conversions, or set Serving Size
//  here, a serving size is set to reflect 247 grams
			"Conversions":[{
                "To":{
                    "Quantity":{
                        "Value":"247",
                        "Type":"Double"
                    },
                    "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"
                },
                "From":{
                    "Quantity":{
                        "Value":"1",
                        "Type":"Double"
                    },
                    "UnitId":"a7df0af5-001f-0000-7484-751e8eaf05c6"
                }
            }]
		},
	    "LabelProfile":{
	        "Authority":{
	            "Id":"BBF4846D-8400-43BB-944D-6021FDA98225",
	            "Regulation":"U.S. 2016 NLEA"
	        },
	        "LabelStyle":"Standard",
	        "LabelFormat":"Full",
	        "AlternateHeading":{"en-US":"New Heading"},
	        "ServingSize":{"en-US":"1"},
	        "ServingsPerContainer":{"en-US":"1"}
	    },
        "EditDetails":{
            "EditMessage":"Creating New Recipe",
            "EditCaller":{
                "Name":"Our PLM System"
            }
        }
	}]
}
REST Request (Composite Ingredient)
POST http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={
	"CompositeIngredientEdits":[{
		"CompositeIngredient":{
			"Name":{"en-US":"New Comp Ing"},
	        "CommonName":{"en-US":"New 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":"Creating New Composite Ingredient",
            "EditCaller":{
                "Name":"Our PLM System"
            }
        }
	}]
}
REST Response
{
    "AddedFoodsCount": 1,
    "Foods": [
        {
            "$type": "Esha.DomainModel.Serialization.IngredientDto, Esha.DomainModel.Serialization",
            "NutrientProfileIdSpecified": false,
            "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.0
            },
            "DefaultWeightUnitIdSpecified": false,
            "ConversionMapIdSpecified": false,
            "Conversions": [
                {
                    "From": {
                        "Quantity": {
                            "Value": "0.5",
                            "Type": 14
                        },
                        "UnitId": "a7df0af5-0003-0000-7484-751e8eaf05c6"
                    },
                    "ConversionFactor": {
                        "Value": "1",
                        "Type": 14
                    },
                    "To": {
                        "Quantity": {
                            "Value": "127",
                            "Type": 14
                        },
                        "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6"
                    }
                }
            ],
            "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,
            "IngredientStatementSettings": [
                {
                    "ItemsOverrideText": {
                        "en-US": "Item One, Item Two, Item Three"
                    },
                    "StatementNameOverride": {
                        "en-US": "Custom Ingredient Statement"
                    },
                    "AdditionalItems": null,
                    "CompositionBehavior": 85,
                    "Authority": null,
                    "FoodId": "00000000-0000-0000-0000-000000000000",
                    "CreatedSpecified": false,
                    "ModifiedSpecified": false,
                    "IdSpecified": false
                }
            ],
            "IngredientStatementSettingsSpecified": true,
            "AllergenStatements": [
                {
                    "AllergenGroupIds": [
                        "f01975c0-0191-0000-ff88-2a01e505d63d"
                    ],
                    "AdditionalText": null,
                    "IsAdditionalUserOverriden": false,
                    "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": [
                "6748e1fb-0002-0000-1900-705b14f8f910"
            ],
            "GroupsIdsSpecified": true,
            "NutrientTransformIdsSpecified": false,
            "ImagesSpecified": false,
            "LabelsSpecified": false,
            "AnalysisOverrides": null,
            "PropertyValues": null,
            "Id": "752eb9c2-2409-1ccd-bede-d3a51c0fdeba",
            "IdSpecified": true
        }
    ],
    "Errors": [],
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}