Public/Invoke-MerakiNetworkWirelessSetDefaultEthernetPortsProfile.ps1

function Invoke-MerakiNetworkWirelessSetDefaultEthernetPortsProfile {
    <#
    .SYNOPSIS
    Sets a network wireless Ethernet ports profile as default.
     
    .DESCRIPTION
    The Invoke-MerakiNetworkWirelessSetDefaultEthernetPortsProfile function allows you to set a network wireless Ethernet ports profile as default by providing the authentication token, network ID, and the profile ID.
     
    .PARAMETER AuthToken
    The authentication token (API key) required to access the Meraki Dashboard API.
     
    .PARAMETER NetworkId
    The ID of the network.
     
    .PARAMETER ProfileID
    The ID of the profile to be set as default.
     
    .EXAMPLE
    Invoke-MerakiNetworkWirelessSetDefaultEthernetPortsProfile -AuthToken "your-api-token" -NetworkId "1234" -ProfileID "1001"
     
    This example sets a network wireless Ethernet ports profile as default with the specified profile ID.
     
    .NOTES
    The function requires the "Invoke-RestMethod" cmdlet to be available.
     
    The function returns the response from the API if the operation is successful, otherwise, it displays an error message.
    #>

    
        [CmdletBinding()]
        param (
            [parameter(Mandatory=$true)]
            [string]$AuthToken,
            [parameter(Mandatory=$true)]
            [string]$NetworkId,
            [parameter(Mandatory=$true)]
            [string]$ProfileID
        )
    
        try {
            $header = @{
                "X-Cisco-Meraki-API-Key" = $AuthToken
                "content-type" = "application/json; charset=utf-8"
            }
    
            $url = "https://api.meraki.com/api/v1/networks/$NetworkId/wireless/ethernet/ports/profiles/assign"
    
            $body = @{
                "profileId" = $ProfileID
            } | ConvertTo-Json -Compress
    
            $response = Invoke-RestMethod -Method Post -Uri $url -Header $header -UserAgent "MerakiPowerShellModule/1.0.2 DocNougat" -Body $body
            return $response
        }
        catch {
            Write-Host $_
        }
    }