Public/Get-SSCApplications.ps1

function Get-SSCApplications {
    <#
    .SYNOPSIS
        Get information about SSC applications.
    .DESCRIPTION
        Get information about SSC applications.
    .PARAMETER Fields
        A comma separated list of fields to return.
    .PARAMETER FullTextSearch
        If 'true', interpret 'Query' as full text search query, defaults to 'false'.
    .PARAMETER Query
        A search-spec of full text search query.
    .PARAMETER OrderBy
        A comma separated list of fields to order by.
    .PARAMETER Start
        Starting offset for applications returned.
        Default is 0.
    .PARAMETER Limit
        Limit the number of applications returned to this number.
        If '-1' or '0' no limit is applied .
        Default is 200.
    .PARAMETER Raw
        If specified, provide raw output and do not parse any responses.
    .PARAMETER Token
        SSC token to use.
        If empty, the value from PS4SSC will be used.
    .PARAMETER Proxy
        Proxy server to use.
        Default value is the value set by Set-SSCConfig
    .EXAMPLE
        # Get the first 50 applications in the system
        Get-SSCApplications -Limit 50
     .EXAMPLE
        # Get any applications with search string "bank" in their fields, e.g. name, description etc.
        Get-SSCApplications -FullTextSearch -Query "bank"
    .LINK
        http://localhost:8080/html/docs/api-reference/index.jsp#/project-controller/listProject
    .FUNCTIONALITY
        Fortify Software Security Center
    #>

    [CmdletBinding()]
    param (
        [string]$Fields,
        [switch]$FullTextSearch,
        [string]$Query,
        [string]$OrderBy,
        [switch]$Raw,
        [int]$Start = 0,
        [int]$Limit = 200,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [string]$Token = $Script:PS4SSC.Token,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [string]$SscUri = $Script:PS4SSC.SscUri,

        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [string]$Proxy = $Script:PS4SSC.Proxy,

        [switch]$ForceVerbose = $Script:PS4SSC.ForceVerbose
    )
    begin
    {
        $Params = @{}
        if ($Proxy) {
            $Params['Proxy'] = $Proxy
        }
        if ($ForceVerbose) {
            $Params.Add('ForceVerbose', $True)
            $VerbosePreference = "Continue"
        }
        Write-Verbose "Get-SSCApplications Bound Parameters: $( $PSBoundParameters | Remove-SensitiveData | Out-String )"
        $Body = @{
            start = $Start
            limit = $Limit
        }
        if ($Fields) {
            $Body.Add("fields", $Fields)
        }
        if ($OrderBy) {
            $Body.Add("orderby", $OrderBy)
        }
        if ($FullTextSearch) {
            $Body.Add("fulltextsearch", $true)
        } else {
            $Body.Add("fulltextsearch", $false)
        }
        if ($Query) {
            $Body.Add("q", $Query)
        }
        $RawApplications = @()
        $TotalCount = 0
    }
    process
    {
        Write-Verbose "Send-SSCApi -Method Get -Operation '/api/v1/projects'" #$Params
        $Response = Send-SSCApi -Method Get -Operation "/api/v1/projects" -Body $Body @Params
        $TotalCount = $Response.count
        $RawApplications = $Response.data
        Write-Verbose "Retrieved $TotalCount applications"
    }
    end {
        if ($Raw) {
            $RawApplications
        } else {
            Parse-SSCApplication -InputObject $RawApplications
        }
    }
}