Use the Add IP API to add an IPv6 type of IP address on your server. This IP address can be used for the creation of VPS on the server. You can add single IP address or pass in multiple IP addresses as shown. In addition to that MAC IDs can also be passed which will be binded to the IP address.
You cannot add IPs to an IP Pool which has NAT enabled.
See also: Add IP guide.
HTTP Request
https://hostname:4085/index.php?act=addips
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addips | The action specified to carry out the operation and return "done" as "1" after the IP(s) have been successfully added | Yes |
iptype | POST | Int | 4 for IPv4, 6 for IPv6 | Yes |
ips6 | POST | array | An two dimensional array containing IPv6 addresses | Yes |
macs | POST | text | An array containing mac addresses | No |
ipv6_1 | POST | text | The first field of the Ipv6 address | No |
ipv6_2 | POST | text | The second field of the Ipv6 address | No |
ipv6_3 | POST | text | The third field of the Ipv6 address | No |
ipv6_4 | POST | text | The fourth field of the Ipv6 address | No |
ipv6_5 | POST | text | The fifth field of the Ipv6 address | No |
ipv6_6 | POST | text | The sixth field of the Ipv6 address | No |
ipv6_num | POST | Int | The number of IPv6 addresses | No |
ippid | POST | Int | The IP Pool ID | No |
ip_serid | POST | Int | The server ID | No |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['iptype'] = 6; //4 for ipv4 & 6 for ipv6
$post['ips6'] = array(array('1234','0f0f','0f0f','0123','1000','0000','eca7','071f'));
$post['macs'] = array('');
$post['ipv6_1'] = '';
$post['ipv6_2'] = '';
$post['ipv6_3'] = '';
$post['ipv6_4'] = '';
$post['ipv6_5'] = '';
$post['ipv6_6'] = '';
$post['ipv6_num'] = '';
$post['ippid'] = 3;
$post['ip_serid'] = '0';
$output = $admin->addips($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add IP",
"done": {
"range": {
"235615": "1234:0f0f:0f0f:0123:1000:0000:eca7:071f"
},
"done": 1
},
"timenow": 1481873949,
"time_taken": "0.104"
}