I am having an issue using "Invoke-RestMethod" for Powershell to pull the clients (devices) list. I have setup the API and I am able to get some information like the Admins or the Network ID, Org ID, etc. I just can't seem to figure out how to pull my devices. I have looked at the documentation over and over and it is not working. I end up getting an Error 400: Bad request.
Here is the documentation I followed to Get Clients: https://developer.cisco.com/meraki/api-v1/#!get-network-clients
Here is my Powershell script (scrubbed). Sorry, they don't have a code button for Powershell:
$APIKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
$orgid = "XXXXX"
$networkid = "N_XXXXXXXXXXXXXXXXXXXXXXXX"
$headers = @{
"Content-Type" = "application/json"
"Accept" = "application/json"
"X-Cisco-Meraki-API-Key" = $APIKey
}
Invoke-RestMethod -Method Get -Uri "https://api.meraki.com/api/v1/networks/$($networkid)/clients" -Headers $Headers
That is what I am thinking (per the documentation) should work. I am not sure where I am going wrong. I have Systems Manager only and I have devices that have been added to it. I would like that list.