XF 2.2 Nodes - plain vs flattened

alexAlToader

New member
Hi,

I dont understand this phrase from the docs:

GET nodes/flattened
Gets a flattened node tree. Traversing this will return a list of nodes in the expected order.​

Can someone please explain the difference between plain ian d flattened please?
I think this is in nodes and a few other places.

Cheers!
 

Brogan

XenForo moderator
Staff member
With just nodes you see the tree map as the first part of the print:

Code:
{
    "tree_map": {
        "0": [
            1,
            2,
            12,
            3,
            4
        ],
        "1": [
            32,
            182,
            187,
            186,
            33,
            47
        ],
        "33": [
            34
        ],
        "34": [
            296
        ],
        "47": [
            183
        ],
        "2": [
            35,
            298,
            36,
            40
        ],
        "12": [
            37,
            39
        ],
        "3": [
            184,
            299,
            41,
            42
        ],
        "4": [
            43
        ]
    },
    "nodes": [
        {
            "breadcrumbs": [],
            "description": "",
            "display_in_list": true,
            "display_order": 100,
            "node_id": 1,
            "node_name": null,
            "node_type_id": "Category",
            "parent_node_id": 0,
            "title": "Formula One",
            "type_data": {},
            "view_url": "https://localhost/cta/#formula-one.1"
        },


With nodes/flattened there is no tree map but there is a depth attribute:

Code:
{
    "nodes_flat": [
        {
            "node": {
                "breadcrumbs": [],
                "description": "",
                "display_in_list": true,
                "display_order": 100,
                "node_id": 1,
                "node_name": null,
                "node_type_id": "Category",
                "parent_node_id": 0,
                "title": "Formula One",
                "type_data": {},
                "view_url": "https://localhost/cta/#formula-one.1"
            },
            "depth": 0
        },
 
Top