Created
April 27, 2010 19:57
-
-
Save jasonlyles/381225 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
require 'rest_client' | |
xml = <<-eos | |
<?xml version='1.0' encoding='UTF-8'?> | |
<server> | |
<id>20</id> | |
<hostname>steve</hostname> | |
<param-1>test1_update</param-1> | |
<param-2>test2_update</param-2> | |
<os>Windows</os> | |
<build-date>#{Time.now}</build-date> | |
<network-interfaces type='array'> | |
<network-interface> | |
<server-id>20</server-id> | |
<ip-address>10.10.10.58</ip-address> | |
<netmask>255.255.192.0</netmask> | |
</network-interface> | |
</network-interfaces> | |
</server> | |
eos | |
#if record doesn't exist, then POST | |
#url = 'https://report3.sd.local/servers.xml' #new record url | |
url = 'https://report3.sd.local/servers/update/20'#update a record url #temp hard-coding 20 | |
response = RestClient.put(url, xml, :content_type => 'text/xml') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment