Get-HuduCompanies returns a company object when Id is specified
Closed this issue · 1 comments
adamburley commented
Cmdlet: Get-HuduCompanies
Issue
At least as of Hudu V2.24, the Hudu API returns a companies
object at the root GET /companies/{id}
call. This is not illustrated in the API docs.
This results in an inconsistent response from Get-HuduCompanies
depending if you're calling by ID, name, or for all companies. A small change on Line 57 of Get-HuduCompanies.ps1
would resolve this inconsistency for both cases:
Current
$Company = Invoke-HuduRequest -Method get -Resource "/api/v1/companies/$Id"
return $Company
Potential Fix
$Company = Invoke-HuduRequest -Method get -Resource "/api/v1/companies/$Id"
if ($Company | Get-Member -Name company) { return $Company.company } else { return $Company }
greenlighttec commented
This has been fixed and will be live in the next version.