09-27-2023 12:17 PM
This is based on the Postman documentation and some other stuff I saw online. I am able to use the same API key and uri to perform a get through Postman.
For automation reasons I would like to use Powershell. This is a piece of a bigger script that generates a random password and makes an update using a PUT. I have simplified it to what is seen below in the screenshot (including making it a GET) to make it easier to diagnose (hopefully).
Also, if the uri has https, then do I need the tls1.2 line (line 3)?
Thanks.
Solved! Go to Solution.
09-27-2023 06:09 PM
Your syntax is right.
That should give you back an HTTP 200 along with some other data.
It definitely seems like the connection is getting blocked somewhere.
09-27-2023 01:46 PM
This appears to be a fundamental issue, it is saying it is unable to connect to https://api.meraki.com/
Can I web browser on that machine connect? When I try I get redirected to the Meraki dashboard login (so this should happen for you as well).
You don't have an internal proxy server or something you need to use to connect to the Internet?
09-27-2023 03:07 PM
Thanks for the response.
api.meraki.com redirects to the dashboard from a browser on the same machine.
I don't believe there is a proxy. The same operation can be done from Postman, but powershell gives the error shown prior.
I also tried using nXXX.meraki.com through powershell (just to try other things) and it was unsuccessful as well (with the same error).
09-27-2023 03:22 PM
Are you able to make a request to google.com? (aka, prove you can access something else on the Internet)
09-27-2023 05:45 PM
Is this sufficient. Maybe powershell is blocked by something? Not sure if my syntax is even correct.
09-27-2023 06:09 PM
Your syntax is right.
That should give you back an HTTP 200 along with some other data.
It definitely seems like the connection is getting blocked somewhere.
09-28-2023 06:35 PM
Yeah, Powershell was blocked by CarbonBlack.
09-28-2023 06:36 PM
Thank you both for your help.
09-27-2023 04:10 PM
I personally haven't set the TLS version in my scripts.
Not sure whether that would cause a problem or not.
As @Philip D'Ath mentioned - the error could be indicating a connection problem to the API backend.
For reference, this is a script that I use quite frequently without issue.
Meraki/Meraki Update Switchports.ps1 at main · Brash92/Meraki (github.com)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide