mpulse/Get-mPulseQueryData.ps1

function Get-mPulseQueryData
{
    Param(
        [Parameter(Mandatory=$true)]  [string] $Token,
        [Parameter(Mandatory=$true)]  [string] $AppKey,
        [Parameter(Mandatory=$true)]  [string] $Parameter,
        [Parameter(Mandatory=$false)] [string] $Date,
        [Parameter(Mandatory=$false)] [string] $Timer,
        [Parameter(Mandatory=$false)] [string] $Dimension,
        [Parameter(Mandatory=$false)] [string] $SeriesFormat,
        [Parameter(Mandatory=$false)] [string] $Format,
        [Parameter(Mandatory=$false)] [string] $DateStart,
        [Parameter(Mandatory=$false)] [string] $DateEnd,
        [Parameter(Mandatory=$false)] [string] $BandwidthBlock
    )

    $RequestURL = "https://mpulse.soasta.com/concerto/mpulse/api/v2/$AppKey/$Parameter?date=$Date&timer=$Timer&dimension=$Dimension&series-format=$SeriesFormat&format=$Format&date-start=$DateStart&DateEnd=$DateEnd&bandwidth-block=$BandwidthBlock"
    $ParsedURL = Remove-NullQueryParameters -ReqURL $RequestURL

    $Headers = @{
        'Content-Type' = 'application/json'
    }

    try {
        if($env:https_proxy){
            $Result = Invoke-RestMethod -Method GET -Uri $ParsedURL -Headers $Headers -Body $Body -proxy $env:https_proxy
        }
        else{
            $Result = Invoke-RestMethod -Method GET -Uri $ParsedURL -Headers $Headers -Body $Body
        }
        return $Result
    }
    catch {
        throw $_.Exception
    }
              
}