Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Summary: Creates new foods with the Food Edits provided.

Request Type: NewFoodRequest

...

REST Request
Code Block
languagejs
titleREST Request (Ingredient)
linenumberstrue
collapsetrue
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"},
                        "StatementNameOverride":{"en-USes-MX":"Custom Ingredient Statement"}Artículo Uno, Artículo Dos, Artículo Tres",
                "CompositionBehavior":"Override"        "fr-CA":"Article Un, Article Deux, Article Trois"
   }             ],        },
    "GroupsIds":[
                "6748e1fb-0002-0000-1900-705b14f8f910"
StatementNameOverride":{
           ],             "AmountCosten-US":{"Custom Ingredient Statement",
              "Amount":{          "es-MX":"Declaración de          "Quantity":{ingredientes personalizada",
                        "Typefr-CA":"Double",
 Déclaration d'ingrédients personnalisée"
                      "Value":100  },
                  },  "CompositionBehavior":"Override"
                }
 "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"                 },
],
               "CostGroupsIds":"5"[
             } 		}], 		"NutrientProfile":{ 			"Id":"b6fa0af5-0008"6748e1fb-0002-0000-74841900-751e8eaf05c6705b14f8f910",
            "DefiningAmount":{
  ],
             ""AmountCost":{
                "Amount":{
                    "Quantity":{
                        "Type":"Double",
                        "Value":100
                    },
                    "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"
                },
            "NutrientIdVector":[{    "Cost":"5"
            }
		}],
  "NutrientId		"NutrientProfile":{
			"Id":"84a8709ab6fa0af5-00000008-0000-ebf97484-90cea7d9d44f751e8eaf05c6",
            "DefiningAmount":{
                "Quantity":{
   
                    "Type":"Double",
   
                    "Value":4100
                },
   },             "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"
        },    },
            "NutrientIdVector":[{
                    "NutrientId":"84a8709a-00010000-0000-ebf9-90cea7d9d44f",
                    "Quantity":{
                        "Type":"Double",
                        "Value":14
                    },
                },
                {
         ]  		},         "EditDetailsNutrientId":{"84a8709a-0001-0000-ebf9-90cea7d9d44f",
                    "EditMessageQuantity":"Creating New Ingredient",{
                        "EditCallerType":{"Double",
                        "NameValue":"Our PLM System"1
                    },
                }   	}]
}
Code Block
languagexml
title
           
            ]
		},
        "EditDetails":{
            "EditMessage":"Creating New Ingredient",
            "EditCaller":{
                "Name":"Our PLM System"
            }
        }
	}]
}


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"},
Code Block
languagexml
titleREST Request (Recipe)
linenumberstrue
collapsetrue
true
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",
            "CommonName":{"en-US":"New Recipe Common Name"}, 	        "UserCodefr-CA":"REC-987",
	Déclaration d'ingrédients personnalisée"
        "Brand":{ 	            "Supplier":"Am Sweeteners - Middlesex",
	},
                    "ProductCompositionBehavior":"Product X"
	Override"
                },
	        "AllergenStatements":[{ 	   ],
	        "AllergenGroupIdsGroupsIds":[
	                "7d52c4c5021c021f-e396000a-4e8c0000-ae8e8d69-ca5dd9ddc3070b60293379ea",
	        ],
	      ]  "AmountCost":{
	           }], 			"IngredientStatementSettingsAmount":[{
	                "Quantity":{
	                    "ItemsOverrideTextType":{"en-US":"Item OneDouble",
Item Two, Item Three"},	                      "StatementNameOverrideValue":{"en-US":"Custom Ingredient Statement"},100
	                },
	     "CompositionBehavior":"Override"           "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"
	     }       },
	     ],
	        "GroupsIdsCost":["5"
	        },
	   "021c021f-000a-0000-8d69-0b60293379ea" 	    "Items":[{
	   ], 	        "AmountCost":{"FoodId":"752eb9c2-0001-0000-bede-d3a51c0fdeba",
	            "Amount":{
	                "Quantity":{
	                    "TypeValue":"Double100",
	                    "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 "Cost":"5"
	to reflect 247 grams
			"Conversions":[{
       }, 	        "ItemsTo":[{
	
                    "FoodIdQuantity":"752eb9c2-0001-0000-bede-d3a51c0fdeba",
	{
            "Amount":{ 	           "Value":"247",
    "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 			"ConversionsFrom":[{
                    "ToQuantity":{
                        "QuantityValue":{"1",
                        "ValueType":"247",Double"
                    },
                    "UnitId":"a7df0af5-001f-0000-7484-751e8eaf05c6"
                }
 "Type":"Double"           }]
		},
	    "LabelProfile":{
	   },     "Authority":{
 	              "UnitIdId":"a7df0af5BBF4846D-00088400-000043BB-7484944D-751e8eaf05c66021FDA98225",
	            "Regulation":"U.S. 2016 NLEA"
	 },       },
	         "FromLabelStyle":{"Standard",
	            "LabelFormat":"Full",
	        "QuantityAlternateHeading":{"en-US":"New Heading"},
	        "ServingSize":{"en-US":"1"},
	              "Value"ServingsPerContainer":{"en-US":"1",}
	    },
        "EditDetails":{
            "TypeEditMessage":"Double"Creating New Recipe",
                "EditCaller":{
 },                     "UnitId"Name":"a7df0af5-001f-0000-7484-751e8eaf05c6"
 Our PLM System"
            }
 }       }
	}]
}


Code Block
languagejs
titleREST Request (Composite Ingredient)
linenumberstrue
collapsetrue
POST http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1
 }]
		},
	    "LabelProfile":{
	        "AuthorityContent-Type: text/plain
Host: localhost:80

request={
	"CompositeIngredientEdits":[{
		"CompositeIngredient":{
	            "Id":"BBF4846D-8400-43BB-944D-6021FDA98225",
	 			"Name":{"en-US":"New Comp Ing"},
	           "RegulationCommonName":"U.S. 2016 NLEA"
	        {"en-US":"New CompIng Common Name"},
	        "LabelStyleUserCode":"StandardREC-987",
	        "LabelFormatBrand":"Full",{
	            "AlternateHeadingSupplier":{"en-US":"New Heading"}Am Sweeteners - Middlesex",
	            "ServingSizeProduct":{"en-US":"1""Product X"
	        },
	        "ServingsPerContainerAllergenStatements":{"en-US":"1"}[{
	    },
        "EditDetailsAllergenGroupIds":{[
	                "EditMessage":"Creating New Recipe",7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307",
	            ]
	    "EditCaller":{    }],
            "NameIngredientStatementSettings":"Our[
  PLM System"             }{
        } 	}] }
Code Block
languagejs
titleREST Request (Composite Ingredient)
linenumberstrue
collapsetrue
POST http://localhost:80/rest/FoodEditService.svc/NewFood HTTP/1.1 Content-Type: text/plain
Host: localhost:80

request={
	"CompositeIngredientEdits":[{
		"CompositeIngredient":{
			"Name":{"       "ItemsOverrideText":{
                        "en-US":"New Comp Ing"},
	Item One, Item Two, Item Three",
            "CommonName":{"en-US":"New CompIng Common Name"}, 	        "UserCodees-MX":"REC-987",
	Artículo Uno, Artículo Dos, Artículo Tres",
           "Brand":{ 	            "Supplierfr-CA":"Am Sweeteners - Middlesex",
	"Article Un, Article Deux, Article Trois"
              "Product":"Product X" 	        },
	        "AllergenStatements":[{
	            "AllergenGroupIdsStatementNameOverride":[{
	                "7d52c4c5-e396-4e8c-ae8e-ca5dd9ddc307", 	       "en-US":"Custom Ingredient Statement",
    ] 	        }], 			"IngredientStatementSettings":[          "es-MX":"Declaración de ingredientes personalizada",
   {                     "ItemsOverrideText":{"en-USfr-CA":"Item One, Item Two, Item Three"},Déclaration d'ingrédients personnalisée"
                       "StatementNameOverride":{"en-US":"Custom Ingredient Statement"},
                    "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"
            }
        }
	}]
}

...