Currently trying to utilize the Rest API using Shortcuts on iOS.
I need some help trying to use the PUT command through shortcuts on iOS. I have tested the same setup with a get command and it works without issues. I can't figure out a way to change the ssid name. Basically updating any parameter through PUT. Not sure if its an issue on the way I am using the Headers or the Body to pass through all the variables that need to be updated.
Solved! Go to Solution.
Couple of things:
Yes, I tested in Postman it worked no issue and used the Code option to view it in python Code to get more visibility.
I am using the option "1" for the SSID to indicate the Second SSID.
I have tried with a "/", I was just testing all the options at this point.
I think the issue is on the way it handles the Body and additional Header for Content Type.
I tried it without the content Type and still did not work.
unfortunately it doesn't give me any sort of error. Unless you know of a way to add a function to the shortcuts to show the error. It just stalls on that part of the sequence. Like such:
Awesome, it worked. Did not think to do that.
The GET command worked with:
So I assumed it would work with the PUT. Thanks for that the shard for my organization was my solution. Don't know why. If you have more information as to why please let me know. It would be awesome to know.
The PUT command works on postman without the org shard.
Now off to program Siri to turn on and off my wifi.
Good to hear!
The reason why is described here:
Note also that most HTTP libraries and clients will not follow a redirect with an HTTP verb other than GET, and may instead follow the redirect but substitute GET for the HTTP verb. As a result, you may find a redirect on DELETE, POST, or PUT will look as though a GET was requested. To avoid this, first perform a GET on the organization you are working with, and store the URL you are working with, then use that URL for subsequent requests (particularly those that modify state).
Also want to point this out. Seems that on the iOS Shortcuts it wasn't following the redirect. According to the documentation it is up to the client to follow the redirect.
Retrieve the list of organizations for the API key specified in X-Cisco-Meraki-API-Key:
GET https://api.meraki.com/api/v0/organizations Response code: 302Response: redirect to https://n123.meraki.com/api/v0/organizations
Note that the request is redirected to n123.meraki.com. A 302 may happen on any API call, including those that modify state such as DELETE, POST, and PUT. When a GET is redirected, the status code will be 302. When a non-GET is redirected, the status code will be 307 for Postman, or 308 for any other client. Client applications must follow these redirects. No action will be taken by the host issuing the redirect, so even non-idempotent requests are safe to retry on the new host.