Skip to content

Instantly share code, notes, and snippets.

@fatmcgav
Created January 15, 2016 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatmcgav/5ff17978d388a7801221 to your computer and use it in GitHub Desktop.
Save fatmcgav/5ff17978d388a7801221 to your computer and use it in GitHub Desktop.
Foreman API Creation attempt
# curl -sS -u provisioner -k -H "Content-Type: application/json" -XPOST http://foreman.weareact.net/api/v2/hosts -d '
{
"host": {
"name": "test1.test.weareact.net",
"enabled": true,
"ipaddress": "10.106.81.15"
}
}'
Enter host password for user 'provisioner':
<html><body>You are being <a href="https://foreman.weareact.net/api/hosts">redirected</a>.</body></html>
2016-01-15 17:21:29 [app] [I]
|
| Started POST "/api/v2/hosts" for 10.106.81.15 at 2016-01-15 17:21:29 +0000
2016-01-15 17:21:29 [app] [I] Processing by Api::V2::HostsController#create as JSON
2016-01-15 17:21:29 [app] [I] Parameters: {"host"=>{"name"=>"test1.test.weareact.net", "enabled"=>true, "ipaddress"=>"10.106.81.15"}, "apiv"=>"v2"}
2016-01-15 17:21:29 [app] [I] Redirected to https://foreman.weareact.net/api/hosts
2016-01-15 17:21:29 [app] [I] Filter chain halted as #<Proc:0x000000072182a0@/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/force_ssl.rb:28> rendered or redirected
2016-01-15 17:21:29 [app] [I] Completed 301 Moved Permanently in 1ms (ActiveRecord: 0.0ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment