src/Get-HighWindsSubAccount.ps1
function Get-HighWindsSubAccount { Param( [Parameter(Mandatory)] [String] $Token, [Parameter(Mandatory)] [String] $AccountHash, [Parameter()] [switch] $Recursive ) $Path = "/api/v3/accounts/$AccountHash/subaccounts"#?recursive=$($Recursive.IsPresent)" $URI = 'https://striketracker.highwinds.com' + $Path $Headers = @{ 'Content-Type' = 'application/json' 'Accept' = 'application/json' 'Authorization' = "Bearer $Token" } try { $Result = Invoke-RestMethod -Method GET -Uri $URI -Headers $Headers -Proxy $env:https_proxy return $Result.list } catch { throw $_ } } |