Public/Get-ZomentumProducts.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
function Get-ZomentumProducts { <# .SYNOPSIS Gets Products from the Zomentum API. .DESCRIPTION Retrieves Products from the Zomentum API - supports a variety of filtering parameters. .OUTPUTS A powershell object containing the response. #> [CmdletBinding()] Param( # Product ID for retrieving a single client [Parameter( ParameterSetName = 'Single', Mandatory = $True )] [string]$ProductID, # An Object containing filter variables [Parameter( ParameterSetName = 'Multiple')] [PSCustomObject]$Filters, # The Child entities to include with the records. [Parameter( ParameterSetName = 'Multiple')] [string]$IncludeChildren ) if ($ProductID) { Write-Verbose "Fetching Single Product" $Products = Invoke-ZomentumRequest -method get -resource "items/$ProductID" } else { $QueryString = '' if ($IncludeChildren){ $QueryString = $QueryString + "&included_child_entities=$IncludeChildren" } Write-Verbose "Fetching Multiple Products" $Products = Invoke-ZomentumRequest -method get -resource "items" -Filters $Filters -MultiFetch } return $Products } |