Private/Invoke/Invoke-CWMPostMaster.ps1
function Invoke-CWMPostMaster { [CmdletBinding()] param ( $Object, [string]$Endpoint ) Write-Verbose $Object #Write-Verbose $Arguments.Value #$global:TArguments = $Arguments $URI = New-CWMUrl -Endpoint $Endpoint $Body = $Object $Body = $(ConvertTo-Json -inputobject $Body -depth 8 ) Write-Verbose $Body $WebRequestArguments = @{ Uri = $URI Method = 'Post' ContentType = 'application/json' Body = $Body } $Result = Invoke-CWMWebRequest -Arguments $WebRequestArguments if($Result.content){ $Result = $Result.content | ConvertFrom-Json } return $Result } |