It works great - if I wanted to control ALL Switches. Which I don’t. Instead, I’m looking to have the SmartApp have access to 8 switches, and through the POST URL, only manipulate the setting of an individual switch.

Here’s the code I’ve come up with, but it’s giving me an error that the method isn’t supported.

Admittedly it’s a clone of the tutorial, which is a great starting point. Just trying to do a foreach loop of the switches array from the defined switches. if a match is made from the :zoneName URL variable, then do the command (on or off).

That message typically means that the wrong HTTP verb was used to make the web service request. What HTTP method are you using to control the switches? Note that /switches/zone/command URL requires an HTTP PUT - so make sure you aren’t using a GET or POST.

I’m new to this but trying to learn. Can you please explain what you mean by the " /switches/zone/command URL " I understand the /switches and /command, it’s the zone that I don’t understand? What exactly is a zone?

I am trying to control lights individually. For testing, I have been trying to turn on/off a light in my house named ‘Family Room Table Lamp’. how do I reference that single lamp in the URL?

I copied your code, although I did make a change to the mappings from /switches/:command/:sname to /switches/:sname/:command since that seemed more sensible. And I used curl to send this request (edited to hide the sensitive bits)

I’m new to this but trying to learn. Can you please explain what you mean by the " /switches/zone/command URL " I understand the /switches and /command, it’s the zone that I don’t understand? What exactly is a zone?

The zone was within the context of the custom SmartApp code listed in the first post of this thread.

The example by @carlovn uses the same HTTP Web Service SmartApp concept but with a different path of /switches/:command/:sname which implies that there is a command and sname variable as part of his SmartApp’s path.

Keep in mind the order of the parameters… his example would be something like:

After publishing your smart app for yourself, did you open it on your phone in the Smartthings app to add the switches you want to control?

You can add logging to the updateSwitches function in your smart app and then check the “Live Logging” tab in the IDE while issuing the curl command to see what happens. (log.debug “executing updateSwitches ${sname} ${command}”)

If all else fails, maybe share your code. It will enable us to better help you.

I have updated my post above with a shortened version of my complete app, just in case it might help. And for what it’s worth, I started out the same way as you. I am not a groovy developer. I got most of what I needed from either the documentation, Google or this community.

Maybe it would help if I described what I am trying to accomplish. I have a device in my house called a MasterLink Gateway, it is made by Bang & Olufsen and is used to act as the bridge between the B&O MasterLink network of audio/video devices and a home automation system. The idea is that using the MLGW you can control things like lights, blinds, curtains, windows, etc from the same remote you use to control your TV and stereo.
For non-B&O products, the gateway allows you to create custom drivers. Those drivers can be used to make requests to web services.
So my goal is to figure out how to control individual lights by sending requests to the web API.