Functions/Get-SchoolDepartment.ps1
function Get-SchoolDepartment { <# .LINK https://github.com/Sekers/SKYAPI/wiki .LINK Endpoint: https://developer.sky.blackbaud.com/docs/services/school/operations/V1AcademicsDepartmentsGet .SYNOPSIS Education Management School API - Returns a collection of academic departments. .DESCRIPTION Education Management School API - Returns a collection of academic departments. Requires at least one of the following roles in the Education Management system: - Academic Group Manager - Platform Manager .PARAMETER level_id Optional parameter to specify a school level ID to limit response to departments of a specific school level. Use Get-SchoolLevel to get a list of levels to filter by. .EXAMPLE Get-SchoolDepartment .EXAMPLE Get-SchoolDepartment -level_id 229 #> [cmdletbinding()] Param( [Parameter( Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [string]$level_id ) # Set the endpoints $endpoint = 'https://api.sky.blackbaud.com/school/v1/academics/departments' # Set the response field $ResponseField = "value" # Set the parameters $parameters = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) foreach ($parameter in $PSBoundParameters.GetEnumerator()) { $parameters.Add($parameter.Key,$parameter.Value) } # Get the SKY API subscription key $sky_api_config = Get-SKYAPIConfig -ConfigPath $sky_api_config_file_path $sky_api_subscription_key = $sky_api_config.api_subscription_key # Grab the security tokens $AuthTokensFromFile = Get-SKYAPIAuthTokensFromFile $response = Get-SKYAPIUnpagedEntity -url $endpoint -endUrl $endUrl -api_key $sky_api_subscription_key -authorisation $AuthTokensFromFile -params $parameters -response_field $ResponseField $response } |