Public/Set-MerakiNetworkClientSplashAuthorizationStatus.ps1

function Set-MerakiNetworkClientSplashAuthorizationStatus {
    <#
    .SYNOPSIS
    Updates the splash authorization status for a client on a Meraki network using the Meraki Dashboard API.
 
    .DESCRIPTION
    The Set-MerakiNetworkClientSplashAuthorizationStatus function allows you to update the splash authorization status for a specified client on a Meraki network by providing the authentication token, network ID, client ID, and a client splash authorization status configuration string.
 
    .PARAMETER AuthToken
    The authentication token (API key) required to access the Meraki Dashboard API.
 
    .PARAMETER NetworkId
    The ID of the Meraki network for which you want to update the client splash authorization status.
 
    .PARAMETER ClientId
    The ID of the client for which you want to update the splash authorization status.
 
    .PARAMETER ClientSplashAuthStatusConfig
    A string containing the client splash authorization status configuration. The string should be in JSON format and should include the "ssids" property, as well as the authorization status for each SSID.
 
    .EXAMPLE
    $config = [PSCustomObject]@{
        ssids = @{
            "0" = @{
                isAuthorized = $true
            }
            "1" = @{
                isAuthorized = $false
            }
            "2" = @{
                isAuthorized = $true
            }
        }
    }
 
    $config = $config | ConvertTo-Json -Compress
    Set-MerakiNetworkClientSplashAuthorizationStatus -AuthToken "your-api-token" -NetworkId "L_123456789012345678" -ClientId "123456789012345" -ClientSplashAuthStatusConfig $config
 
    This example sets the splash authorization status for the client with ID "123456789012345" on the Meraki network with ID "L_123456789012345678" for SSID 0 to authorized, for SSID 1 to unauthorized, and for SSID 2 to authorized.
 
    .NOTES
    The function requires the "Invoke-RestMethod" cmdlet to be available.
 
    The function returns the response from the API if the splash authorization status update is successful, otherwise, it displays an error message.
    #>


    [CmdletBinding()]
    param (
        [parameter(Mandatory=$true)]
        [string]$AuthToken,
        [parameter(Mandatory=$true)]
        [string]$NetworkId,
        [parameter(Mandatory=$true)]
        [string]$ClientId,
        [parameter(Mandatory=$true)]
        [string]$ClientSplashAuthStatusConfig
    )
    try {
        $header = @{
            "X-Cisco-Meraki-API-Key" = $AuthToken
            "content-type" = "application/json; charset=utf-8"
        }

        $body = $ClientSplashAuthStatusConfig

        $url = "https://api.meraki.com/api/v1/networks/$NetworkId/clients/$ClientId/splashAuthorizationStatus"

        $response = Invoke-RestMethod -Method Put -Uri $url -Header $header -UserAgent "MerakiPowerShellModule/1.0.2 DocNougat" -Body $body
        return $response
    }
    catch {
        Write-Host $_
    }
}