public/api/Get-MBSAPIAdministrator.ps1

function Get-MBSAPIAdministrator {
    <#
    .SYNOPSIS
    List MBS account administrators
     
    .DESCRIPTION
    Calls GET request to api/Administrators.
     
    .PARAMETER AdminID
    Admin ID.
     
    .PARAMETER ProfileName
    Profile name used with MSP360 PowerShell for MBS API (set via Set-MBSApiCredential)
 
    .EXAMPLE
    Get-MBSAPIAdministrator -ProfileName profile
     
    .EXAMPLE
    Get-MBSAPIAdministrator -ID 008410b2-e1f7-47f9-b35e-a7d13b74b516 -ProfileName profile
 
    Get administrator details with specific ID.
     
    .INPUTS
    System.Management.Automation.PSCustomObject
    String
 
    .OUTPUTS
    System.Management.Automation.PSCustomObject
 
    .NOTES
        Author: Alex Volkov
    .LINK
 
    #>

    
    [CmdletBinding()]
    param (
        #
        [Parameter(Mandatory=$false, HelpMessage="Administrator ID", ValueFromPipelineByPropertyName, ValueFromPipeline=$true)]
        [Alias("ID")]
        [string]$AdminID,
        #
        [Parameter(Mandatory=$false, HelpMessage="The profile name, which must be unique.")]
        [string]
        $ProfileName
    )
    
    begin {
       
    }
    
    process {
        if ($ID) {
            $Administrators = Invoke-RestMethod -Uri ((Get-MBSApiUrl).Administrators+"/"+$ID) -Method Get -Headers (Get-MBSAPIHeader -ProfileName $ProfileName)
        }else{
            $Administrators = Invoke-RestMethod -Uri (Get-MBSApiUrl).Administrators -Method Get -Headers (Get-MBSAPIHeader -ProfileName $ProfileName)
        }
        return $Administrators
    }
    
    end {
        
    }
}