Public/New-MerakiOrganizationInventoryDevicesSwapsBulk.ps1
function New-MerakiOrganizationInventoryDevicesSwapsBulk { <# .SYNOPSIS Performs bulk device swaps in an organization's inventory. .DESCRIPTION This function allows you to perform bulk device swaps in an organization's inventory by providing the authentication token, organization ID, and a JSON string with the swap details. .PARAMETER AuthToken The authentication token (API key) required to access the Meraki Dashboard API. .PARAMETER OrganizationId The ID of the organization. .PARAMETER SwapDetails A compressed JSON string representing the swap details. .EXAMPLE $SwapDetails = @{ swaps = @( @{ devices = @{ new = "Q2XX-XXXX-XXXX" old = "Q2YY-YYYY-YYYY" } afterAction = "remove from network" }, @{ devices = @{ new = "Q2AA-AAAA-AAAA" old = "Q2BB-BBBB-BBBB" } afterAction = "release from organization inventory" } ) } $SwapDetailsJson = $SwapDetails | ConvertTo-Json -Compress -Depth 4 New-MerakiOrganizationInventoryDevicesSwapsBulk -AuthToken "your-api-token" -OrganizationId "123456" -SwapDetails $SwapDetailsJson This example performs bulk device swaps in the organization with ID "123456" using the provided swap details. .NOTES For more information about the Meraki API, visit https://developer.cisco.com/meraki/api-v1/. #> [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$AuthToken, [parameter(Mandatory=$true)] [string]$OrganizationId, [parameter(Mandatory=$true)] [string]$SwapDetails ) try { $header = @{ "X-Cisco-Meraki-API-Key" = $AuthToken "content-type" = "application/json; charset=utf-8" } $url = "https://api.meraki.com/api/v1/organizations/$OrganizationId/inventory/devices/swaps/bulk" $response = Invoke-RestMethod -Method Post -Uri $url -headers $header -UserAgent "MerakiPowerShellModule/1.1.2 DocNougat" -Body $SwapDetails return $response } catch { Write-Debug $_ Throw $_ } } |