- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Get the port details of wireless access point
I used this script also to get the switch port detail
$apiKey = "{APIKEY}"
$url = "https://n121.meraki.com/api/v1/networks/{networkID}/clients/{clientID}"
$headers = @{
"X-Cisco-Meraki-API-Key" = $apikey
}
$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
$response
But I didn't get the any port details
OUTPUT:
Please help me in this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The correct API to GET information about the Switch port is this one:
"https://api.meraki.com/api/v1/devices/$serial/switchPorts"
Please, if this post was useful, leave your kudos and mark it as solved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/devices/$serial/switchPorts call is for API v0 version
/devices/{serial}/switch/ports is the current one: https://developer.cisco.com/meraki/api-v1/get-device-switch-ports/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used but getting bad request below is the screenshot:
Could you please help me in this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This error typically indicates a invalid syntax.
Try this one:
$apiKey = "{APIKEY}"
$serial = "{serial}"
$url = "https://api.meraki.com/api/v1/devices/$serial/switch/ports"
$headers = @{
"X-Cisco-Meraki-API-Key" = $apiKey
}
$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
$response
Please, if this post was useful, leave your kudos and mark it as solved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Same error:
Getting same error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you send the full error in text please?
This makes it very difficult to analyze.
Please, if this post was useful, leave your kudos and mark it as solved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
