Folder Information Test

**Do not use in production environment without professional assistance**

When creating a folder, it is just as important to know what the API is looking for as it is to be able to make the API call to create the folder.  Below is an example of how to get the Stub of the folder so that you know how to form the API call to create the folder.

To view this script on the Cyberhill Github page, click here.


Function Get-SSFolderStub {
    Param
    (
         [Parameter(Mandatory=$true, Position=0)]
         [string] $URI,
         [Parameter(Mandatory=$true, Position=1)]
         [string] $APIKey
    )

    try
    {
    $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
    $headers.Add("Authorization", "Bearer $APIKey")
    

    $diagnostics = Invoke-RestMethod "$URI/api/v1/folders/stub" -Method Get -Headers $headers
    return $diagnostics
    }
    catch
    {
        $result = $_.Exception.Response.GetResponseStream();
        $reader = New-Object System.IO.StreamReader($result);
        $reader.BaseStream.Position = 0;
        $reader.DiscardBufferedData();
        $responseBody = $reader.ReadToEnd() | ConvertFrom-Json
        Write-Host "ERROR: ($responseBody.error)"
        return;
    }
} 

Gate Form

"*" indicates required fields