- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
How to set the Domain Name of a network through API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-02-2016 11:56 AM
Hi, I can create network view and add network through API.
However, to make our system work, we need to set the Domian Name (in the IPV4 DHCP options) of the network just added.
Is there an API call to do that?
In addition, can we add a Zone in DNS through API?
Thanks in advance.
Re: How to set the Domain Name of a network through API
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-17-2017 01:48 PM - edited 02-23-2017 07:25 AM
First time response! Hope this helps..
Was finally able to add a DHCP Router in the IP DHCP Options via WAPI! Figure it shouldn't be far off from where you are wanting to go. Please, just use this as a means to an end and not an actual solution!
Here is the Code:
(The Java Boolean got me! Remember it's true not True!!)
(Needed to google building a java Array filled with hashes for the $json value)
use strict;
use Data:umper;
use JSON;
use LWP;
use LWP:imple;
use POSIX qw(strftime);
...
my $json = '{
"options":
[
{
"value": "1.1.1.1",
"vendor_class": "DHCP",
"name": "routers",
"use_option": true
}
]
}';
my $req = HTTP::Request->new(PUT => $baseURI . 'network/ZG5zLm5ldHdvcmskMTAuMTY5EyLjAvMjYvMTk5'); #This _ref was manually updated in this script, format was important.
$req->authorization_basic($username, $passwd);
$req->header('Content-Type' => 'application/json');
$req->content($json);
$agent->request($req)->as_string;
#print Dumper($req);
#exit;
my $r = $agent->request($req);
print "Provisioned $name and default gateway : " . $r->content;
I hope this helps your endeavour.