Public/Invoke-MerakiNetworkSmBypassActivationLockAttempt.ps1

function Invoke-MerakiNetworkSmBypassActivationLockAttempt {
    <#
    .SYNOPSIS
    Creates a new bypass activation lock attempt for a Meraki network.
     
    .DESCRIPTION
    The Invoke-MerakiNetworkSmBypassActivationLockAttempt function allows you to create a new bypass activation lock attempt for a specified Meraki network by providing the authentication token, network ID, and a string of device IDs.
     
    .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 create a bypass activation lock attempt.
     
    .PARAMETER BypassAttempt
    A string of device IDs for the bypass activation lock attempt.
     
    .EXAMPLE
    $config = [PSCustomObject]@{
        ids = @(
            "1284392014819",
            "2983092129865"
        )
    }
    $config = $config | ConvertTo-Json -Compress
    Invoke-MerakiNetworkSmBypassActivationLockAttempt -AuthToken "your-api-token" -NetworkId "1234" -BypassAttempt $config
    This example creates a new bypass activation lock attempt for the Meraki network with ID "1234" and sets the device IDs to "1284392014819, 2983092129865".
     
    .NOTES
    The function requires the "Invoke-RestMethod" cmdlet to be available.
     
    The function returns the response from the API if the creation is successful, otherwise, it displays an error message.
    #>

    
        [CmdletBinding()]
        param (
            [parameter(Mandatory=$true)]
            [string]$AuthToken,
            [parameter(Mandatory=$true)]
            [string]$NetworkId,
            [parameter(Mandatory=$true)]
            [string]$BypassAttempt
        )
    
        try {
            $header = @{
                "X-Cisco-Meraki-API-Key" = $AuthToken
                "content-type" = "application/json; charset=utf-8"
            }
    
            $url = "https://api.meraki.com/api/v1/networks/$NetworkId/sm/bypassActivationLockAttempt"
    
            $body = $BypassAttempt
    
            $response = Invoke-RestMethod -Method Post -Uri $url -headers $header -UserAgent "MerakiPowerShellModule/1.0.8 DocNougat" -Body $body
            return $response
        }
        catch {
        Write-Debug $_
        Throw $_
    }
    }