Jetzt verfügbar:  Berichte für DRACOONMehr Infos

Getting full node list from data-rooms (subfolders with children)

Kommentare

2 Kommentare

  • Avatar
    Christoph Dengler

    The endpoint you need is /v4/nodes/search

    You can only load the metadata for the nodes in tranches of 500 pieces. So you have to get 500 nodes until you get less than or equal to 500 at some point and in the next step 0.
    Of course you have to include a variable that counts from which number should be picked up in the next step and a variable that accepts all nodes and is incremented with each step.

    Here is an example implemented in PowerShell:

    $allElements = $null
    $offset = 0

    do {
        $parameter = @{
            "depth_level"   = "-1"
            "search_string" = "*"
            #"parent_id" = "25" #search only under this node
            "limit"         = "500"
            "offset"        = $offset
            #"filter" = "type:eq:folder:room" # search only for folders & rooms
        }

        #do the search
        $AccountUrl = $APIUrl + "/v4/nodes/search"
        $Response = Invoke-WebRequest -URI $AccountUrl -Method Get -ContentType "application/json" -Headers @{Authorization = ("Bearer {0}" -f $Token) } -Body $parameter
        $content = ConvertFrom-Json $Response.content
        $inhalt = $content.items
        $offset = $offset + 500
        $allElements = $allElements + $inhalt
    }

    while ($inhalt -ne $null)
    Write-Host $allElements.count " nodes were found."

     

     

     

    0
    Aktionen für Kommentare Permalink
  • Avatar
    Vladimirs Gavriluks

    Thanks! works like a charm!

    0
    Aktionen für Kommentare Permalink

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.