Created
December 9, 2014 16:34
-
-
Save stbenjam/75cc79a7d2baaed316ee 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' | |
require 'json' | |
require 'openssl' | |
uri = 'https://admin:[email protected]/api/v2/hosts' | |
hostinfo = {} | |
hostinfo[:environment] = 'Standard_Base' | |
hostinfo[:hostgroup_id] = 2 | |
hostinfo[:name] = 'testtest2' | |
body = {hosts: [hostinfo] } | |
headers = {"Content-Type" => 'application/json', "Accept" => 'application/json;version=2'} | |
request = RestClient::Request.new( | |
method: :post, | |
url: uri, | |
headers: headers, | |
payload: body.to_json | |
) | |
begin | |
request.execute | |
rescue => e | |
puts e.inspect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment