Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
    • Tags

    Creating new hosts using curl via api

    Posted on

    Been trying to create a new host in Satellite 6 via curl command, just testing this out to verify it works and be able to help our developers who will be calling the API from remote Enterprise systems to create hosts in a automated fashion.

    Not many examples can be found, and I get it. The payload produced will vary greatly based on the data you have placed in your satellite server (organizations/environments/hostgroups/locations/,,,, )
    I put the below together, but when i attempt to post the payload via curl, I receive a rather perplexing error message.

    I know that hammer is a great tool, I used it to help me put together the payload file below. But really need to better understand the payload requirements/format, so I can better explain them to my developers.

    Can anyone point me in the right direction?
    Or is this simply a Satellite Bug, that I should open a case for?

    # cat payload.json
    {"host":
      {"name":"myhost.mydomain.com",
       "location_id":2,
       "organization_id":1,
       "environment_id":1,
       "architecture_id":1,
       "operatingsystem_id":7,
       "medium_id":15,
       "ptable_id":127,
       "hostgroup_id":13,
       "build":true,
       "enabled":true,
       "provision_method":"build",
       "managed":true,
       "compute_attributes":{
          "volumes_attributes":{}
       },
       "content_facet_attributes":{},
       "subscription_facet_attributes":{},
       "overwrite":true,
       "host_parameters_attributes":{},
       "interfaces_attributes":[
         [0],{
            "primary":"true",
            "provision":"true",
            "mac":"00:17:ab:cd:12:34",
            "ip":"192.168.200.20"}],
       "root_pass":"RaNdOm_ChArAcTeRs"}}
    
    # json_verify  ./payload.json
    JSON is valid
    
    # curl -s -k -u USER:PASS -d @payload.json -H "Content-Content-Type: application/json" -X POST https://sat6.mydomain.com/api/v2/hosts
    {
      "error": {"message":"no implicit conversion of Symbol into Integer"}
    }
    

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat