I have been experimenting with the API from PowerShell using cURL in insecure mode. I've been successful with my GET requests, but I am unable to successfully use a POST request to add a static route.
Here is the command I am using (with the private bits replaced):
curl -Lkvi -H "X-Cisco-Meraki-API-Key: $privatesBits" \
-H 'Content-Type: application/json' \
-X POST \
--data-binary \
'{"name":"testing","subnet":"192.168.4.13/32","gatewayIP":"192.168.248.9","enabled":"true"}' \
"https://$n000.meraki.com/api/v0/networks/$privateBits/staticRoutes"
I get an error 400: bad request back from the server:
< HTTP/1.1 400 Bad Request
As well as this feedback:
There was a problem in the JSON you submitted: not a number or other value at line 1, column 1 [parse.c:422]*
I have tested the same function in Postman with the same API key, URL, and json text with no problems. That is all well and good, but I would prefer to execute these tasks from a PowerShell script. What am I missing here? Is it necessary for me to provide a certificate for these changes to work? I get the same results using ConvertTo-Json in my script as well as when I hard code it. Passing it directly to cURL at the CLI gives the same results as well.
Any guidance would be greatly appreciated.