How Do I... (Use Cases)
If If you want to get a jumpstart on common API use cases, you came to the right place! Expand the text areas below for walkthroughs and code samples of API calls...
IP Blocks - Update Fields
Context: I unassigned an IP address and now it's in the Holding Tank. Now I want to assign an IP from the Holding Tank. I don't want to unassign an IP randomly, in case it is allocated to a Resource. What are my options?
...
How do I update the notes field of an IP block using the API in PHP?
Expand |
---|
1) Start with providing instance information, API key, Secret Key, and DNS Server IP; set up the connection Code Block |
---|
| <?php
//
// This file walks through an example of how to look up a block id number
// in ProVision, and then use it to attach a notes field
//
// supply the URL of your ProVision instance, your API key and your Secret key.
$proVisionURL = "https://ops.6connect.com/qa-4.2.2";
$apiKey = "32-5DAYTJEE2TZHOFOB";
$apiSecretKey = "48b278ec873bda473a323dbc467f8669";
// this example uses 6connect's PHP APIClient
require_once("APIClient.php");
// set up the connection
$apiClient = new APIClient($proVisionURL, $apiKey, $apiSecretKey); |
2) Split the metadata you want to have showing in the notes, and find the block with which it should associate Code Block |
---|
| // lets imagine we have some metadata in the following format:
//
$string = "10.1.245.5||DFW7|HP a5820x|its-erp.dfw7.us.corp||";
//
// And we want to insert the Colo, Server type, and hostname into the Notes field of the IP block
// first we split everything up
$pieces = explode("|", $string);
$ip = $pieces[0];
$colo = $pieces[2];
$type = $pieces[3];
$host = $pieces[4];
// then we pull the IP block using the API.
$params = array();
$params['block'] = "$ip/32"; // the IP block we're looking for, with netmask
// make the call to the IPAM-GET endpoint
$apiResponse = $apiClient->sendRequest('ipam', 'get', $params);
if ($apiResponse->status != 1) {
echo "Could not pull information for block: $ip/32 !\n";
die();
}
if (trim($apiResponse->message) == "No blocks found.") {
echo "IP block $ip/32 not found in ProVison!\n";
die();
}
// we now have the ipObject associated with this IP block. Lets get its block id.
$blockId = $apiResponse->data[0]['id'];
echo "IP block id: $blockId \n"; |
3) Update the block with the notes Code Block |
---|
| // it is time to update the block with the new notes.
$notes = "$colo,$type,$host";
$params = array();
$params['id'] = $blockId;
$params['notes'] = $notes;
// make the call to the IPAM-UPDATE endpoint
$apiResponse = $apiClient->sendRequest('ipam', 'update', $params);
// and done!
echo $apiResponse->message . "\n"; |
|
IP Blocks - Assign / Subassign
Context: I unassigned an IP address and now it's in the Holding Tank. Now I want to assign an IP from the Holding Tank. I don't want to unassign an IP randomly, in case it is allocated to a Resource. What are my options?
Expand |
---|
There are 3 options:
1) If you know the specific IP, you can use use the ipam-get api call to determine if it is in Holding: Code Block |
---|
/api/v1/api.php?target=ipam&action=get&cidr=1.2.3.4/32
{
id:1234,
cidr:"1.2.3.4",
...
resource_name:"Holding"
} |
2) If you want to show all blocks/IPs in Holding, you can use the following ipam-get API call:
Code Block |
---|
/api/v1/api.php?target=ipam&action=get&resourceQuery={"name":"Holding"} |
3) If you know the block is in Holding, you can issue another ipam-unassign API call to move it from Holding to Available:
Code Block |
---|
/api/v1/api.php?target=ipam&action=unassign&block=1.2.3.4/32 |
|
Context: I need to create a Resource Holder, assign them an IP block, then subassign some IPs out of that block to two new Resource Holders. What does this look like in Python?
Expand |
---|
We broke this up in a few steps so it's easier to link together. 1) Let's create a Resource Holder called "Ned |
...
Code Block |
---|
/api/v1/api.php?target=ipam&action=get&cidr=1.2.3.4/32
{
id:1234,
cidr:"1.2.3.4",
...
resource_name:"Holding"
} |
...
Code Block |
---|
/api/v1/api.php?target=ipam&action=get&resourceQuery={"name":"Holding"} |
...
Code Block |
---|
/api/v1/api.php?target=ipam&action=unassign&block=1.2.3.4/32 |
Context: I need to create a Resource Holder, assign them an IP block, then subassign some IPs out of that block to two new Resource Holders. What does this look like in Python?
Expand |
---|
We broke this up in a few steps so it's easier to link together. 1) Let's create a Resource Holder called "Ned" Code Block |
---|
| query_string = 'target=resource&action=add&meta[type]=entry&meta[section]=resource-holder&meta[name]=Ned'
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Create Ned resource holder'
print url, "\n"
data = json.load(urllib2.urlopen(url))
ned_resource_id = data['data']['id'] |
2) Now let's add the 213.29.27.0/24 IP block Code Block |
---|
| query_string = 'target=ipam&action=add&rir=RIPE&block=213.29.27.0/24'
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Create 213.29.27.0/24 block'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
3) With the block in the system, we can assign 213.29.27.0/24 to "Ned" the Resource Holder Code Block |
---|
| query_string = "target=ipam&action=directAssign&block=213.29.27.0/24&resourceId=%d" % (ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Assign 213.29.27.0/24 block to Ned'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
4) Since we plan on assigning IPs out of this block, we should enable subassignments for 213.29.27.0/24 Code Block |
---|
| query_string = 'target=ipam&action=update&block=213.29.27.0/24&allowSubAssignments=true'
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Update 213.29.27.0/24 to allow sub assignments'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
5) Now let's create a Resource Holder "Tara" Code Block |
---|
| query_string = "target=resource&action=add&meta[type]=entry&meta[section]=resource-holder&meta[name]=Tara&meta[parent_id]=%d" % (ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Create Tara resource holder'
print url, "\n"
data = json.load(urllib2.urlopen(url))
tara_resource_id = data['data']['id'] |
6) To keep it interesting, let's create another Resource Holder "Una" Code Block |
---|
| query_string = = "'target=resource&action=add&meta[type]=entry&meta[section]=resource-holder&meta[name]=Una&meta[parent_id]=%d" % (ned_resource_id)=Ned'
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Create UnaNed resource holder'
print url, "\n"
data = json.load(urllib2.urlopen(url))
unaned_resource_id = data['data']['id'] |
7) Assign a /28 block from Ned2) Now let's add the 213.29.27.0/24 to TaraIP block Code Block |
---|
| query_string = "target=ipam&action=smartAssign&type=ipv4&rir=RIPE&mask=28&&resourceId=%d&assignedResourceId=%d" % (tara_resource_id, ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Assign block from Ned\'s 213.29.27.0/24 to Tara'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
8) Then assign another /28 block from Ned's 213.29.27.0/24 to Una Code Block |
---|
| query_string = "target=ipam&action=smartAssign&type=ipv4&rir=RIPE&mask=28&&resourceId=%d&assignedResourceId=%d" % (una_resource_id, ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Assign block from Ned\'s 213.29.27.0/24 to Una'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
|
Context: I need to set up a DNS server using ProVision's API in PHP, create a zone with a few simple records, and push it to the server.
| query_string = 'target=ipam&action=add&rir=RIPE&block=213.29.27.0/24'
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Create 213.29.27.0/24 block'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
3) With the block in the system, we can assign 213.29.27.0/24 to "Ned" the Resource Holder Code Block |
---|
| query_string = "target=ipam&action=directAssign&block=213.29.27.0/24&resourceId=%d" % (ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Assign 213.29.27.0/24 block to Ned'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
4) Since we plan on assigning IPs out of this block, we should enable subassignments for 213.29.27.0/24 Code Block |
---|
| query_string = 'target=ipam&action=update&block=213.29.27.0/24&allowSubAssignments=true'
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Update 213.29.27.0/24 to allow sub assignments'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
5) Now let's create a Resource Holder "Tara" Code Block |
---|
| query_string = "target=resource&action=add&meta[type]=entry&meta[section]=resource-holder&meta[name]=Tara&meta[parent_id]=%d" % (ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Create Tara resource holder'
print url, "\n"
data = json.load(urllib2.urlopen(url))
tara_resource_id = data['data']['id'] |
6) To keep it interesting, let's create another Resource Holder "Una" Code Block |
---|
| query_string = "target=resource&action=add&meta[type]=entry&meta[section]=resource-holder&meta[name]=Una&meta[parent_id]=%d" % (ned_resource_id)
query_string += '&apiKey=' + api_key
hash |
|
Expand |
---|
1) Start with providing instance information, API key, Secret Key, and DNS Server IP Code Block |
---|
| <?php
//
//
// supply the URL of your ProVision instance, your API key and your Secret key.
$proVisionURL = "https://ops.6connect.com/qa-4.2.2";
$apiKey = "Nnvz8xKZDQUWke6gDxb";
$apiSecretKey = "2YojRbrHnToPZ7cDeFBzcTAvcfMbPVmX";
// this example uses 6connect's PHP APIClient
require_once("APIClient.php");
// set up the connection
$apiClient = new APIClient($proVisionURL, $apiKey, $apiSecretKey);
// save this. IP of the DNS Server we're creating.
$serverIp = "208.39.106.184";
|
2) Add a DNS server Code Block |
---|
| // begin making api calls. We begin by adding a simple DNS server.
$params = array();
$params['displayName'] = "Example Server"; // the pretty name of the DNS server
$params['server'] = "208.39.106.184"; // the IP of the DNS Server
$params['active'] = 1; // whether or not this server is currently enabled
$params['transferType'] = "SCP"; = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url // we are using an ISC Bind= server which we will communicate with via SCP
$params['username'] = "6connect"; // the username used to SCP zones to this server
$params['password'] = "password"; // the password used to SCP zones to this server
$params['port'] = 22; base_url + '?' + query_string + '&hash=' + hash
print 'Create Una resource holder'
print url, "\n"
data = json.load(urllib2.urlopen(url))
una_resource_id = data['data']['id'] |
7) Assign a /28 block from Ned's 213.29.27.0/24 to Tara Code Block |
---|
| query_string = "target=ipam&action=smartAssign&type=ipv4&rir=RIPE&mask=28&&resourceId=%d&assignedResourceId=%d" % (tara_resource_id, ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' // the port used to SCP zones to this server
$params['serverType'] = "master"; // whether this server is a master or a slave
$params['SOA'] = "ns1.dns.6connect.net. hostmaster.6connect.net."; // the default SOA
$params['remoteDirectory'] = "/tmp/"; // where to place the zone files on the server
$params['namedConfPath'] = "/tmp/"; // the path to the zones within the configuration file. Usually the same as 'remoteDirectory'
$params['postCommand'] = "touch /tmp/allFinished"; // the command to execute on the server after the transfer is complete.
// add the server
$apiResponse = $apiClient->sendRequest('dnsServer', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added DNS Server '" . $params['displayName'] . "'\n";
} else {
echo "Could not add DNS Server '" . $params['displayName'] . "' !\n";
die();
}
// now we fetch the id of our newly created server
$params = array();
$apiResponse = $apiClient->sendRequest('dnsServer', 'get', $params);
$data = $apiResponse->data;
for ($i = 0; $i < count($data); $i++) {
if ($data[$i]['server'] == $serverIp) {
// we save the id for later.
$serverId = $data[$i]['id'];
break;
}
}
echo "Server Id is: $serverId \n";+ query_string + '&hash=' + hash
print 'Assign block from Ned\'s 213.29.27.0/24 to Tara'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
8) Then assign another /28 block from Ned's 213.29.27.0/24 to Una Code Block |
---|
| query_string = "target=ipam&action=smartAssign&type=ipv4&rir=RIPE&mask=28&&resourceId=%d&assignedResourceId=%d" % (una_resource_id, ned_resource_id)
query_string += '&apiKey=' + api_key
hash = base64.b64encode( hmac.new(api_secret_key, query_string, hashlib.sha256).digest() )
url = base_url + '?' + query_string + '&hash=' + hash
print 'Assign block from Ned\'s 213.29.27.0/24 to Una'
print url, "\n"
data = json.load(urllib2.urlopen(url)) |
|
DNS
Context: I need to set up a DNS server using ProVision's API in PHP, create a zone with a few simple records, and push it to the server.
Expand |
---|
1) Start with providing instance information, API key, Secret Key, and DNS Server IP Code Block |
---|
| <?php
//
//
// supply the URL of your ProVision instance, your API key and your Secret key.
$proVisionURL = "https://ops.6connect.com/qa-4.2.2";
$apiKey = "Nnvz8xKZDQUWke6gDxb";
$apiSecretKey = "2YojRbrHnToPZ7cDeFBzcTAvcfMbPVmX";
// this example uses 6connect's PHP APIClient
require_once("APIClient.php");
// set up the connection
$apiClient = new APIClient($proVisionURL, $apiKey, $apiSecretKey);
// save this. IP of the DNS Server we're creating.
$serverIp = "208.39.106.184";
|
2) Add a DNS server3) Create a zone Code Block |
---|
| // okay, begin making api calls. We begin by adding a simple DNS server is set up -- time to create a zone.
$params = array();
$params['zoneName.
$params = array();
$params['displayName'] = "Example Server"; // the pretty name of the DNS server
$params['server'] = "atestzone.com208.39.106.184"; // zone namethe IP of the DNS Server
$params['zoneResourceIdactive'] = 1; // the owner of the zone; 1 is default
$apiResponse = $apiClient->sendRequest('zone', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added DNS Zone '" . $params['zoneName'] . "'\n";
} else {
echo "Could not add DNS Zone '" . $params['zoneName'] . "' !\n";
die();
}
// snag the zoneId for later.
$zoneId = $apiResponse->data; |
4) Add Zone records Code Block |
---|
| // Lets add some records to our new zone!
$params = array();
$params['newRecordZoneId'] = $zoneId; whether or not this server is currently enabled
$params['transferType'] = "SCP"; // we are using an ISC Bind server which we will communicate with via SCP
$params['username'] = "6connect"; // the username used to SCP zones to this server
$params['password'] = "password"; // the password used to SCP zones to this server
$params['port'] = 22; // parent zone id
$params['newRecordType'] = 'A'; // record type
$params['newRecordHost'] = "www"; // the port used to SCP zones to this server
$params['serverType'] = "master"; // whether this //server theis hosta fieldmaster ofor thea recordslave
$params['newRecordValueSOA'] = "1.2.3.4"; ns1.dns.6connect.net. hostmaster.6connect.net."; // the value field of the recorddefault SOA
$params['newRecordTTLremoteDirectory'] = "3600"; // the value of the TTL field
$apiResponse = $apiClient->sendRequest('record', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added Record to zone #$zoneId\n";
} else {
echo "Could not add Record to zone #$zoneId!\n";
die();
}
$params = array();
$params['newRecordZoneId'] = $zoneId; // parent zone id
$params['newRecordType'] = 'A'; // record type
$params['newRecordHost'] = "dev"; // the host field of the record
$params['newRecordValue'] = "2.3.4.5"; // the value field of the record
$params['newRecordTTL'] = "3600"; // the value of the TTL field/tmp/"; // where to place the zone files on the server
$params['namedConfPath'] = "/tmp/"; // the path to the zones within the configuration file. Usually the same as 'remoteDirectory'
$params['postCommand'] = "touch /tmp/allFinished"; // the command to execute on the server after the transfer is complete.
// add the server
$apiResponse = $apiClient->sendRequest('dnsServer', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added DNS Server '" . $params['displayName'] . "'\n";
} else {
echo "Could not add DNS Server '" . $params['displayName'] . "' !\n";
die();
}
// now we fetch the id of our newly created server
$params = array();
$apiResponse = $apiClient->sendRequest('dnsServer', 'get', $params);
$data = $apiResponse->data;
for ($i = 0; $i < count($data); $i++) {
if ($data[$i]['server'] == $serverIp) {
// we save the id for later.
$serverId = $data[$i]['id'];
break;
}
}
echo "Server Id is: $serverId \n"; |
3) Create a zone Code Block |
---|
| // okay, DNS server is set up -- time to create a zone.
$params = array();
$params['zoneName'] = "atestzone.com"; // zone name
$params['zoneResourceId'] = 1; // the owner of the zone; 1 is default
$apiResponse = $apiClient->sendRequest('recordzone', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added Record to zone #$zoneId DNS Zone '" . $params['zoneName'] . "'\n";
} else {
echo "Could not add Record to zone #$zoneId DNS Zone '" . $params['zoneName'] . "' !\n";
die();
}
// snag the zoneId for later.
$zoneId = $apiResponse->data; |
4) Add Zone records Code Block |
---|
| // Lets add some records to our new zone!
$params = array();
$params['newRecordZoneId'] = $zoneId; // parent zone id
$params['newRecordType'] = 'A'; // record type
$params['newRecordHost'] = "cloudwww"; // the host field of the record
$params['newRecordValue'] = "1.2.3.4.5.6"; // the value field of the record
$params['newRecordTTL'] = "3600"; // the value of the TTL field
$apiResponse = $apiClient->sendRequest('record', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added Record to zone #$zoneId\n";
} else {
echo "Could not add Record to zone #$zoneId!\n";
die();
}
|
4) Link the Zone to the new DNS server and push Code Block |
---|
|
// Okay, we have some zones with records. Time to link this zone to the new DNS Server not add Record to zone #$zoneId!\n";
die();
}
$params = array();
$params['serverIdnewRecordZoneId'] = $serverId; // the server id
$params['zoneId'] = $zoneId; // the$zoneId; // parent zone id
$params['serverSlavenewRecordType'] = 0; // not a slave zone
$apiResponse = $apiClient->sendRequest('zoneLinkage', 'add', $params);
if ($apiResponse->status == 1) {
'A'; echo "Successfully linked Zone #$zoneId to server #serverId\n";
} else {
// record type
$params['newRecordHost'] = "dev"; echo "Could not link Zone #$zoneId to server #serverId!\n";
die();
}
// now we can push the zone to the server
$params = array(); // the host field of the record
$params['zoneIdnewRecordValue'] = $zoneId;"2.3.4.5"; // the value field of the record
$params['newRecordTTL'] = "3600"; // the value zoneof idthe toTTL pushfield
$apiResponse = $apiClient->sendRequest('dnsServerrecord', 'transferSingleadd', $params);
if ($apiResponse->status == 1) {
echo "Zone pushed!Successfully added Record to zone #$zoneId\n";
} else {
echo "Could not add Record pushto zone #$zoneId!\n";
die();
}
?> |
|
Context: How do I update the notes field of an IP block using the API in PHP?
$params = array();
$params['newRecordZoneId'] = $zoneId; // parent zone id
$params['newRecordType'] = 'A'; // record type
$params['newRecordHost'] = "cloud"; // the host field of the record
$params['newRecordValue'] = "3.4.5.6"; // the value field of the record
$params['newRecordTTL'] = "3600"; // the value of the TTL field
$apiResponse = $apiClient->sendRequest('record', 'add', $params);
if ($apiResponse->status == 1) {
echo "Successfully added Record to zone #$zoneId\n";
} else {
echo "Could not add Record to zone #$zoneId!\n";
die();
}
|
4) Link the Zone to the new DNS server and push Code Block |
---|
|
// Okay, we have some zones with records. Time to link this zone to the new DNS Server |
|
Expand |
---|
1) Start with providing instance information, API key, Secret Key, and DNS Server IP; set up the connection Code Block |
---|
| <?php
//
// This file walks through an example of how to look up a block id number
// in ProVision, and then use it to attach a notes field
//
// supply the URL of your ProVision instance, your API key and your Secret key.
$proVisionURL = "https://ops.6connect.com/qa-4.2.2";
$apiKey = "32-5DAYTJEE2TZHOFOB";
$apiSecretKey = "48b278ec873bda473a323dbc467f8669";
// this example uses 6connect's PHP APIClient
require_once("APIClient.php");
// set up the connection
$apiClient = new APIClient($proVisionURL, $apiKey, $apiSecretKey); |
2) Split the metadata you want to have showing in the notes, and find the block with which it should associate Code Block |
---|
| // lets imagine we have some metadata in the following format:
//
$string = "10.1.245.5||DFW7|HP a5820x|its-erp.dfw7.us.corp||";
//
// And we want to insert the Colo, Server type, and hostname into the Notes field of the IP block
// first we split everything up
$pieces = explode("|", $string);
$ip = $pieces[0];
$colo = $pieces[2];
$type = $pieces[3];
$host = $pieces[4];
// then we pull the IP block using the API.
$params = array();
$params['blockserverId'] = "$ip/32"$serverId; // the server id
$params['zoneId'] = $zoneId; // the zone IPid block we're looking for, with netmask
$params['serverSlave'] = 0; // makenot thea call to the IPAM-GET endpointslave zone
$apiResponse = $apiClient->sendRequest('ipamzoneLinkage', 'getadd', $params);
if ($apiResponse->status !== 1) {
echo "Could not pull information for block: $ip/32 !\n";
die();
}
if (trim($apiResponse->message) == "No blocks found.") {
echo "IPSuccessfully blocklinked $ip/32Zone not#$zoneId foundto inserver ProVison!#serverId\n";
} die();
}
// we now have the ipObject associated with this IP block. Lets get its block id.
$blockId = $apiResponse->data[0]['id'];
echo "IP block id: $blockId \n"; |
3) Update the block with the notes Code Block |
---|
| // it is time to update the block with the new notes.
$notes = "$colo,$type,$host";else {
echo "Could not link Zone #$zoneId to server #serverId!\n";
die();
}
// now we can push the zone to the server
$params = array();
$params['idzoneId'] = $blockId;
$params['notes'] = $notes;
// make the call to the IPAM-UPDATE endpoint$zoneId; // the zone id to push
$apiResponse = $apiClient->sendRequest('ipamdnsServer', 'updatetransferSingle', $params);
// and done!
echo $apiResponse->message . "\n";if ($apiResponse->status == 1) {
echo "Zone pushed!\n";
} else {
echo "Could not push zone!\n";
die();
}
?> |
|
DHCP
Context: I need to attach the DHCP module as a child
...