Public/Curanet/Get-Customers.ps1

function Get-Customers() {
    # Get a Curanet 3850 API access token
    $AccessToken = Get-AccessToken

    $AuthorizationHeader = @{
        Authorization="Bearer $AccessToken"
    }

    try {
        $Customers = (Invoke-WebRequest -Uri "https://api.curanet.dk/customers/v1/Customers?itemsPerPage=9999" -Headers $AuthorizationHeader -UseBasicParsing -Method GET).Content | ConvertFrom-Json
    } catch {
        Write-Error "Failed to retreive customers from Curanet 3850 API: $_"
    }

    return $Customers
}