Skip to main content

Price List Tree via REST API

How to Create a Price List Tree via REST API

Written by Petr Pech

Import into the price list tree is currently in a state where NOT_DOCUMENTED import is supported, but it is not documented and we do not recommend using it. It is therefore not fully implemented — for example, identification is only possible by ID. If you still wish to use the import, we will walk you through the process with a simple example.

Descriptions of the records can be found here:

  • strom - describes the basic structure (nodes/branches) of the tree as seen in the application when the tree is enabled; you can find information such as level, order, parent, and path

  • strom-koren - describes the root of the tree; by default this is STR_CEN - Price List Tree

  • strom-cenik - describes the assignment of price list items to individual nodes (branches) of the tree

To better understand the structure and dependencies, we will demonstrate a simple tree example.

The image below shows the path to the "Salt Soaps" category and its level.

In the API, this tree is displayed as follows:

The parent is the preceding node (MYDLA); the path and level represent the order as seen in the application, including the initial "Price List Tree" node.

Creating a Tree

When creating a tree, the required fields are its name, order, and the tree it belongs to. The path and level are calculated automatically.

<winstrom version="1.0">
<strom>
<id>code:TELKREM</id>>
<nazev>Tělové krémy</nazev>
<poradi>1</poradi>
<strom>code:STR_CEN</strom>
<otec>code:KREMY</otec>
</strom>
</winstrom>

The order determines the position at which the node will appear within its category. The tree is the main root of the tree, and the parent is the preceding node in the tree.

Assigning a Price List Item to the Tree

As mentioned, due to implementation constraints, the node must be specified by ID rather than by code.

<winstrom version="1.0">
<strom-cenik>
<!-- idZaznamu = ID nebo kód ceníkové položky,
kterou chcete do stromu přiřadit -->
<idZaznamu>code:TELKREM ABC 500</idZaznamu>

<!-- uzel = ID daného uzlu ve stromu,
které zjistíte dotazem na /strom.xml -->
<uzel>4</uzel>
</strom-cenik>
</winstrom>

After the import is completed, the assigned item TELKREM ABC 500 will appear in the corresponding tree branch (ID=4).

Moving a Tree Branch

To move a branch, you need to update the parent element to the code of the new parent category, and set the order element to a value such as 99 to ensure it is placed at the end.

<winstrom version="1.0">
<strom>
<id>code:PANSKEKREMY</id>
<poradi>99</poradi>
<otec>code:TELKREMY</otec>
</strom>
</winstrom>

This will move the entire PANSKEKREMY category, including all subcategories and assigned items, into the TELKREMY category — not copy it.

Did this answer your question?