I have tried but same error below is the script and output: script: $apiKey = "api key" $serial = "serial number" $url = "https://api.meraki.com/api/v1/devices/$serial/switch/ports" $headers = @{ "X-Cisco-Meraki-API-Key" = $apiKey "Accept" = "application/json" } $response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get $response Output: Invoke-RestMethod : The remote server returned an error: (400) Bad Request. At line:7 char:13 + $response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
... View more