I am trying to send a PUT request to a specific URL, and this has failed in doing so.
If I was doing this through an HTTP requestor GUI, such as one, it would be as simple as a single scroll on the following URL:
Note that the above request specifies a port number. I must also do this when submitting the request through Ruby Code. How do I make such a request in Ruby? Larry's answer helped me point in the right direction, with a little more excavation, guided by this answer, another beautiful Got the solution http: / /www.mywebsite. Com: port / application? Key = apikey & amp; Id = id & amp; Option = enable | Disable
requires 'net / http' port = 8080 host = "127.0.0.1 "Path =" / application? Key = api and id = id and option = enabled "request = net :: HTTP :: Put.new (path, initheader = {'content type' => gt; text / plain '} ) Req.body = "whatever" response = net :: http.new (host, port) .start {| Http | Enter the Http.request (req)} response code
http = Net :: HTTP.new ('www.mywebsite.com', port) response = http.send_request
Comments
Post a Comment