Skip to content

Instantly share code, notes, and snippets.

@jasonlyles
Created April 27, 2010 19:57
Show Gist options
  • Save jasonlyles/381225 to your computer and use it in GitHub Desktop.
Save jasonlyles/381225 to your computer and use it in GitHub Desktop.
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