Creates a new stock item.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
A stock item is a package unit that defines the formats in which an ingredient can be stored or ordered in. It can also describe the same for a recipe, in the case of stockable recipes.
Stock items for stockable recipes
Either main_ingredient_id or stockable_recipe must be given, but not both.
When stockable_recipe is given, you are defining a package for a stockable recipe. The recipe referenced in this field must be stockable.
Defining stock items as units of other stock items
In the PackageDescription object in this endpoint, one of base_unit or unit_stock_item must be given, but not both. When unit_stock_item is given, you are defining this stock item as a multiple of another stock item.
Stock items can be defined in base units (for example g, ml, cl...) but also as units of other stock items. Imagine a Cola that can be purchased as a can (33cl) but also as a pack of 6 cans (therefore 6 units of the base 33cl package).
For clarity, check the examples.
How the name is built
name is optional, and it is not returned as sent. It is treated as a qualifier: it is stored on the package description and returned as package_description.type. The name in the response is composed as <main_ingredient_name> <qualifier> (<content>).
For example, sending name: "Can" for an ingredient called Cola with a content of 200 ml returns name: "Cola Can (200 ml)" and package_description.type: "Can".
If no name is given, the composed name is <main_ingredient_name> (<content>).
Returnable packaging
returnable marks the package as a deposit-bearing container that goes back to the supplier, such as a crate, keg, CO2 cylinder or pallet. It is a marker only: nothing about ordering, counting or costing changes because a package is returnable.
GTIN validation
gtin and every entry of gtin_list must be numeric, 8, 12, 13 or 14 digits long, and carry a valid GS1 check digit. A random number of the right length is rejected.
gtin_list accepts several values. Duplicates are removed and the order you send is kept.
400Validation error. For example: neither main_ingredient_id nor stockable_recipe given, both given, neither base_unit nor unit_stock_item given, or an invalid GTIN.
404The referenced ingredient, recipe or stock item was not found, or belongs to a different library.
