-
-
Save csexton/211951 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xml = <<-eos | |
<?xml version="1.0" encoding="UTF-8"?> | |
<server> | |
<build-date type="datetime" nil="true"></build-date> | |
<created-at type="datetime" nil="true"></created-at> | |
<default-gateway>10.60.1.4</default-gateway> | |
<hostname>XML Test</hostname> | |
<ip-address>0.0.0.0</ip-address> | |
<netmask>255.255.0.0</netmask> | |
<os>FuzzyOS</os> | |
<param-1 nil="true"></param-1> | |
<param-2 nil="true"></param-2> | |
<param-3 nil="true"></param-3> | |
<param-4 nil="true"></param-4> | |
<param-5 nil="true"></param-5> | |
<persistent-route-table>#<RouteTable:0x440aac0></persistent-route-table> | |
<route-table>#<RouteTable:0x440af5c></route-table> | |
<server-type nil="true"></server-type> | |
<service-pack nil="true"></service-pack> | |
<subnet>0.0.0.0</subnet> | |
</server> | |
eos | |
require 'net/http' | |
url = URI.parse('http://report1.atbackup.local/servers/create') | |
req = Net::HTTP::Post.new(url.path) | |
req.body = xml | |
req.set_content_type('text/xml') | |
res = Net::HTTP.new(url.host, url.port).start{|http| http.request(req)} | |
puts res.code | |
puts res.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment