Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
djhornby
Explorer

API - Host creation

I'm using the API to create hosts for the first time.

add host name MYHOST ip-address 192.28.1.115 comments MY HOST

 

But how do I use the host-servers option to configure it as a dns-server

Ive tried:

add host name MYHOST ip-address 192.28.1.115 host-servers dns-server comments MY HOST

But this fails.  I can't find any good examples anywhere.

0 Kudos
3 Replies
funkylicious
Advisor

Hi,
Based on the documentation, dns-server is a boolean value, that means True or False , host-servers dns-server "True" , try it like this.

(1)
djhornby
Explorer

Thanks for the reply....Tried that 😞 No luck.

Worked it out though....It's

add host host-servers.dns-server "true" name MYHOST ip-address 192.168.1.2 comments "this is my Host"

0 Kudos
Bob_Zimmerman
Advisor

For reference, this JSON sent via an HTTP POST to /add-host would yield the same result:

{
  "name": "MYHOST",
  "ip-address": "192.168.1.2",
  "comments": "this is my Host",
  "host-servers": {
    "dns-server": true
  }
}

I add this because it's sometimes a little confusing going from the command line to JSON suitable for sending over the network.

0 Kudos