• This topic has 1 reply, 2 voices, and was last updated November 12, 2016 by Junichi S.

vCenter Folders issue with REST API

  • Hi –

    I’ve got an issue with how Zerto is retrieving vCenter folders which is complicated by the REST API.   I’m trying to use the REST API to retrieve the ID of a vCenter folder to create a VPG.  vCenter uses hierarchical folders, but Zerto seems to only retrieves the folder name, not the hierarchy of the folder.

    For example, if we have:
    <pre style=”padding-left: 30px;”>\Prod
    \Zerto
    \UAT
    \Zerto

    Calling
    <pre style=”padding-left: 30px;”>$baseURL = “https://” + $ZertoServer + “:”+$ZertoPort+”/v1/”
    $TypeJSON = “application/json”
    $FullURL = $baseURL + “virtualizationsites/” + $ZertoSiteIdentifier + “/folders”
    $Result = Invoke-RestMethod -Uri $FullURL -TimeoutSec 100 -Headers $ZertoToken -ContentType $TypeJSON

    Returns all four folders, with no indication of parent folder

    This is the same as create VPG dialog/wizard, but because I’m trying to filter based off folder name, I’m not getting the proper Folder ID.

    Is there any way to either

    1. Return an additional field with the full folder path
    2. Return the folder’s first level parent, which would allow for calculating full path.

    This probably should also fixed in the UI,

    Chris@ChristopherLewis.com
    Tagged: 

    Hey Chris,

    I found the same issue when working with the Folder API and we are working on fixing it in a future release. It can also be an issue if you have the same folder across multiple vSphere datacenter objects, where there is no context as to which datacenter the folder is in when using the API. I’d recommend modifying your vCenter folder naming convention to remove this issue as a workaround. I.E Folder 1 > Folder 2> to be Folder1 > Folder1-Folder2. Or flatten the folder structure to 1 layer and use vSphere tags for logical groupings required for vCenter navigation/management.

    Tagged: 

The forum ‘Scripting and APIs’ is closed to new topics and replies.