Public/Invoke-MerakiNetworkFirmwareUpgradesDeferStagedEvents.ps1

function Invoke-MerakiNetworkFirmwareUpgradesDeferStagedEvents {
    <#
    .SYNOPSIS
    Defers a staged firmware upgrade event for a Meraki network using the Meraki Dashboard API.
 
    .DESCRIPTION
    The Invoke-MerakiNetworkFirmwareUpgradesDeferStagedEvents function allows you to defer a staged firmware upgrade event for a specified Meraki network by providing the authentication token, network ID, and a deferment 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 defer a staged firmware upgrade event.
 
    .EXAMPLE
    Invoke-MerakiNetworkFirmwareUpgradesDeferStagedEvents -AuthToken "your-api-token" -NetworkId "L_123456789012345678"
 
    This example defers the next staged firmware upgrade event for the Meraki network with ID "L_123456789012345678".
 
    .NOTES
    The function requires the "Invoke-RestMethod" cmdlet to be available.
 
    The function returns the response from the API if the deferment is successful, otherwise, it displays an error message.
    #>


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

        $url = "https://api.meraki.com/api/v1/networks/$NetworkId/firmwareUpgrades/staged/events/defer"

        $response = Invoke-RestMethod -Method Post -Uri $url -headers $header -UserAgent "MerakiPowerShellModule/1.1.2 DocNougat"
        return $response
    }
    catch {
        Write-Debug $_
        Throw $_
    }
}