The bill of materials (BOM) feature in Flexi lets you set up the content and structure of the materials that make up a product or semi-finished product. The specific principles and configuration options are described in the documentation for setup in the ABRA Flexi application.
In this documentation, however, we'll take a look at how to work with the bill of materials in the REST API.
⚠️ The bill of materials feature is available starting with the Premium license plan. In lower plans, you won't be able to use the /kusovnik endpoint.
Creating a bill of materials (POST / PUT)
You can create a bill of materials using the method POST or PUT on the URL endpoint /kusovnik. You can find the available fields for the endpoint (i.e. the record type) in the so-called record list.
A single bill of materials record is always either the bill of materials header (product / semi-finished product) or a single material (also referred to as a row or node) that you create for the bill of materials header.
As an example, we'll show you how to create a bill of materials for a single item using only the fields necessary for creation. Many of the fields available in the record type are, in fact, optional.
The fields filled in below in the request for creation are mandatory.
Example
We want to create a bill of materials for the production of a front wheel, including both the header and the material contained within it. We'll therefore include everything in a single request.
XML
POST / PUT to https://demo.flexibee.eu/c/kusovnik.xml
<winstrom version="1.0">
<kusovnik>
<id>ext:KUS:1</id>
<mnoz>1.0</mnoz>
<hladina>1</hladina>
<poradi>1</poradi>
<cesta>1/</cesta>
<otecCenik>code:PŘEDNÍ_KOLO</otecCenik>
<cenik>code:PŘEDNÍ_KOLO</cenik> <!-- Jedná se o hlavičku kusovníku, shodný s otecCenik-->
<otec></otec> <!-- Prázdný, jedná se o hlavičku-->
</kusovnik>
<kusovnik>
<id>ext:KUS:2</id>
<mnoz>1.0</mnoz>
<hladina>2</hladina>
<poradi>1</poradi>
<cesta>1/1/</cesta>
<otecCenik>code:PŘEDNÍ_KOLO</otecCenik>
<cenik>code:RÁFEK</cenik>
<otec>ext:KUS:1</otec>
</kusovnik>
<kusovnik>
<id>ext:KUS:3</id>
<mnoz>32.0</mnoz>
<hladina>2</hladina>
<poradi>2</poradi>
<cesta>1/2/</cesta>
<otecCenik>code:PŘEDNÍ_KOLO</otecCenik>
<cenik>code:DRÁTY</cenik>
<otec>ext:KUS:1</otec>
</kusovnik>
<kusovnik>
<id>ext:KUS:4</id>
<mnoz>1.0</mnoz>
<hladina>2</hladina>
<poradi>3</poradi>
<cesta>1/3/</cesta>
<otecCenik>code:PŘEDNÍ_KOLO</otecCenik>
<cenik>code:STŘED</cenik>
<otec>ext:KUS:1</otec>
</kusovnik>
</winstrom>
JSON
{
"winstrom":{
"@version":"1.0",
"kusovnik":[
{
"id":"ext:KUS:1",
"mnoz":"1.0",
"hladina":"1",
"poradi":"1",
"cesta":"1/",
"otecCenik":"code:PŘEDNÍ_KOLO",
"cenik":"code:PŘEDNÍ_KOLO",
"otec":""
},
{
"id":"ext:KUS:2",
"mnoz":"1.0",
"hladina":"2",
"poradi":"1",
"cesta":"1/1/",
"otecCenik":"code:PŘEDNÍ_KOLO",
"cenik":"code:RÁFEK",
"otec":"ext:KUS:1"
},
{
"id":"ext:KUS:3",
"mnoz":"32.0",
"hladina":"2",
"poradi":"2",
"cesta":"1/2/",
"otecCenik":"code:PŘEDNÍ_KOLO",
"cenik":"code:DRÁTY",
"otec":"ext:KUS:1"
},
{
"id":"ext:KUS:4",
"mnoz":"1.0",
"hladina":"2",
"poradi":"3",
"cesta":"1/3/",
"otecCenik":"code:PŘEDNÍ_KOLO",
"cenik":"code:STŘED",
"otec":"ext:KUS:1"
}
]
}
}
Retrieving a bill of materials (GET)
Using the GET method, you can export all created bills of materials, headers, and individual materials contained within a bill of materials.
Example
We want to retrieve the bill of materials created above, i.e. the complete bill of materials for the price list item with the code "PŘEDNÍ_KOLO".
You can optionally use filtering (in the URL / query), detail level, or any other supported format.
XML
GET to /kusovnik/(otecCenik='code:PŘEDNÍ_KOLO').xml?detail=full
Example of a complete URL address:
https://demo.flexibee.eu/c/flexi/kusovnik/(otecCenik='code:PŘEDNÍ_KOLO').xml?detail=full
JSON
GET to /kusovnik/(otecCenik='code:PŘEDNÍ_KOLO').json?detail=full
Example of a complete URL address:
https://demo.flexibee.eu/c/flexi/kusovnik/(otecCenik='code:PŘEDNÍ_KOLO').json?detail=full
Recalculating bill of materials prices
The value of a product (an item that has a bill of materials set up) can be recalculated based on the prices of the materials and/or services (in general, the items configured in the bill of materials).
The entire procedure is described in our documentation.
FAQ
Can bill of materials prices be updated automatically?
Yes, but currently only via the API — by regularly sending a POST / PUT request to the URL address specified in the documentation for price recalculation.
Can I create multiple bills of materials at once?
Yes, simply include everything in a single request. The structure must be the same as in the creation example.
How do I delete a bill of materials?
By using action="delete", i.e. by performing an action. You can find more details in our documentation.
