cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5046
Views
6
Helpful
4
Replies

Error with API call getOrganizationApplianceTrafficShapingVpnExclusionsByNetwork

uvega
Visitor

Hello,

I am having some serious trouble getting the vpn exclusion rules for a single network or few in my organization.

I keep getting the error networkIds must be an array and I have tried any suggestion I have found to fix with no better results.

I am regularly using v1 and postman API v1.58, your help would be appreciated.

See example below:

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "••••••")

$response | ConvertTo-Json
1 Accepted Solution

Accepted Solutions

obrigg
Meraki Employee All-Star
Meraki Employee All-Star

Arrays in REST calls have an annoying syntax. Did you try this?

View solution in original post

4 Replies 4

obrigg
Meraki Employee All-Star
Meraki Employee All-Star

Arrays in REST calls have an annoying syntax. Did you try this?

Hello, thank you. that worked perfectly. here is the code that worked for me for reference

# Set up headers correctly for Meraki API authentication
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("X-Cisco-Meraki-API-Key", "YOURAPIKEY") # Replace with actual API key

# Define the API URL with proper query parameters
$networkId = "L_XXXX"
$organizationId = "XXXXXX"
$apiUrl = "https://api.meraki.com/api/v1/organizations/$organizationId/appliance/trafficShaping/vpnExclusions/byNetwork?networkIds[]=$networkId"

# Make the GET request
try {
$response = Invoke-RestMethod -Uri $apiUrl -Method 'GET' -Headers $headers
$response | ConvertTo-Json -Depth 3 # Convert response to JSON format for readability
} catch {
Write-Host "Error occurred: $_"
}

Well that was an annoying 30 mins. Thanks for the link.

Raphael_L
Meraki Community All-Star
Meraki Community All-Star

networkIds[]=xxxxxxxxx should be the parameter