Closed ggrip closed 9 years ago
RESTful interface requires you to POST or PUT instead of a GET
It would be nice if we could have the option to provide the HTTP method for the URL.
I too have some of my own custom software that I have amazon-echo-ha-bridge
pointing at and had to make my URL endpoints GET
s. I'm not very comfortable with this, as GET
urls are easy to hit and these URLs are pointing at potentially important things. I'd prefer they be POST
s or PUT
s. If anything, it's more compliant with a REST system.
If anything, it'd be nice the default was POST
.
I agree. I was initially worried/lazy about the difficulty of creating templates for the post/put body nor had any use case that required a different http method . Should be an easy add. Should be in the next release this week.
On Wed, Aug 12, 2015, 12:23 Jon Maddox notifications@github.com wrote:
RESTful interface requires you to POST or PUT instead of a GET
It would be nice if we could have the option to provide the HTTP method for the URL.
I too have some of my own custom software that I have amazon-echo-ha-bridge pointing at and had to make my URL endpoints GETs. I'm not very comfortable with this, as GET urls are easy to hit and these URLs are pointing at potentially important things. I'd prefer they be POSTs or PUTs. If anything, it's more compliant with a REST system.
If anything, it'd be nice the default was POST.
— Reply to this email directly or view it on GitHub https://github.com/armzilla/amazon-echo-ha-bridge/issues/25#issuecomment-130381965 .
Should be in the next release this week
Nice!! Thanks!
added in 28ba226b7a2c649a115f0809bf69855eb5c4bec6
please try out in the preview v0.2.1 release. create a new device
{ "name": "test device", "deviceType": "switch", "offUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31", "onUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}", "contentType" : "application/json", "httpVerb":"POST", "contentBody" : "{\"fooBar\":\"baz\"}" }
note the escape of quotes in the content body. currently no validation of the content type, invalid content types WILL explode!
Arm,
request; as I don't know Java, I really can't help with this, but it would be nice to have a drop down that let you put in local scripts instead of URLs for on and off. I use a mix of Wemo and Lifx bulbs and neither have a RESTful interface that I can use with your software (Lifx's RESTful interface requires you to POST or PUT instead of a GET). Again, not really an issue, but more of an enhancement request. Thanks again.
Dan-