Public/Set-MerakiNetworkFirmwareUpgradesStagedStages.ps1

function Set-MerakiNetworkFirmwareUpgradesStagedStages {
    <#
    .SYNOPSIS
    Updates the firmware upgrade staged stages for a Meraki network using the Meraki Dashboard API.
 
    .DESCRIPTION
    The Set-MerakiNetworkFirmwareUpgradesStagedStages function allows you to update the firmware upgrade staged stages for a specified Meraki network by providing the authentication token, network ID, and a staged stages 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 firmware upgrade staged stages.
 
    .PARAMETER StagedStagesConfig
    A string containing the staged stages configuration. The string should be in JSON format and should include the "_json" property, which is an array of objects containing the "group" and "id" properties.
 
    .EXAMPLE
    $config = [PSCustomObject]@{
        _json = @(
            @{
                group = @{
                    id = "1234"
                }
            }
        )
    }
 
    $config = $config | ConvertTo-Json -Compress
    Set-MerakiNetworkFirmwareUpgradesStagedStages -AuthToken "your-api-token" -NetworkId "L_123456789012345678" -StagedStagesConfig $config
 
    This example updates the firmware upgrade staged stages for the Meraki network with ID "L_123456789012345678", assigning the staged upgrade group with ID "1234" to the staged stages.
 
    .NOTES
    The function requires the "Invoke-RestMethod" cmdlet to be available.
 
    The function returns the response from the API if the firmware upgrade staged stages 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]$StagedStagesConfig
    )
    try {
        $header = @{
            "X-Cisco-Meraki-API-Key" = $AuthToken
            "content-type" = "application/json; charset=utf-8"
        }

        $body = $StagedStagesConfig

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

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