Let the platform do the work

/ProductTemplates/tree GET

ProductTemplate API

Summary:

This endpoint is designed to return a paged recordset of one level of product templates and product categories in a N-level deep tree representing the relationship between categories and templates. The results are loosely filtered (wildcard before and after).

Query Parameters:

Param Description Optional
filter The filter used to search Product Template and Product Category names. %filter% true
root The ID of the root node you wish to retrieve. Defaults to null (the root level) true
offset Specifies the numeric value of the offset you wish to retrieve true
max_num Specifies the numeric value of the max number of records you wish to receive. Default is 20. true

Response Parameters:

Param Description
id The id of the item (Product Category/Template)
Data The name of the item
state Specifies the open or closed state of the element. (used for categories)
index Specifies the index of this element in the current level.

Response:

        { 
            "records":[
                {
                    "id":"023d316a-d9d0-11e7-9f54-02425392a518",
                    "type":"category",
                    "data":"Christen Widgets",
                    "state":"closed",
                    "index":0
                },
                {
                    "id":"01828a4a-d9d0-11e7-8989-02425392a518",
                    "type":"category",
                    "data":"Desktops",
                    "state":"closed",
                    "index":1
                }
            ],
            "next_offset":2
        }