Private/Curanet/New-CuranetResellerSession.ps1

function New-CuranetResellerSession() {
    param (
        [Parameter(Mandatory)]
        [ValidateSet("3370", "3850")]
        [string]$Account
    )
    $CuranetSessionCredentials = Get-CuranetSessionCredentials -Account $Account

    Invoke-RestMethod -Uri "$($CuranetBaseURL)/Login" -Method Post -Headers @{
        'Content-Type' = 'application/x-www-form-urlencoded'
    } -SessionVariable Session -Form $CuranetSessionCredentials | Out-Null

    if ($Session) {
        $Global:CuranetResellerSession = $Session
    } else {
        throw "Failed to login to Curanet Reseller with username $($CuranetSessionCredentials.Username): $_ $Global:CuranetResellerSession"
    }
}