Public/Get-RemedyInterface.ps1

Function Get-RemedyInterface {
<#
    .SYNOPSIS
        Returns the list of Remedy API interfaces that can be interrogated.
 
    .DESCRIPTION
        Use this cmdlet to see what API interfaces are available. This is useful for writing direct queries of the API
        or to support future cmdlet development.
 
    .EXAMPLE
        Get-RemedyInterfaces
 
        Returns the list of available Remedy interfaces.
#>

    [cmdletbinding()]
    Param(
        # Optional: Name of an interface to see the properties of that interface. Exclude to list all interfaces.
        [String]$Interface,

        # An encoded string representing your Remedy Credentials as generated by the Set-RemedyApiConfig cmdlet.
        [String]$EncodedCredentials = (Get-RemedyApiConfig).Credentials,
        
        # The Remedy API URL. E.g: https://<localhost>:<port>/api
        [String]$APIURL = (Get-RemedyApiConfig).APIURL
    )

    If (-not (Test-RemedyApiConfig)) { Throw 'Remedy API Test failed. Ensure the config has been set correctly via Set-RemedyApiConfig.' }

    $Headers = @{
        Authorization = "Basic $EncodedCredentials"
    }

    $URL = "$APIURL/$Interface"

    Try {
        Invoke-RestMethod -URI $URL -Headers $Headers -ErrorAction Stop
                
    } Catch {
        Throw $_
    }
}