ip.php¶
IP address and network infrastructure management module: retrieving IP information, managing PTR records, traffic monitoring, working with subnets and VLANs.
API Methods¶
| Method | Action | Description |
|---|---|---|
get_client_ip | get client IP | Returns the current IP address of the client making the request to the API. |
get_ip | get IP information | Returns full network configuration information for a specific IP address (mask, gateway, etc.) |
get_ptr | check IP PTR record | Checks whether the specified IP address belongs to a server with a given ID and returns the current PTR record for this IP in the specified location. |
get_traffic | get traffic | Returns inbound and outbound traffic data for the specified IP address for the selected period. Can return both summary information and detailed timestamps. |
list_free_ip | get list of free IPs | Returns a list of unused IPv4 addresses for a specific location based on Route Reflector tags. For clients, it is only available within their own subnets. |
set_main | set main IP for server | Sets the specified IP address as the primary (main) for the server's network interface. Updates data in the WHMCS billing system if necessary. |
update_ptr | update PTR record | Updates the reverse DNS record (PTR) for the specified IP address. Requires permission verification and proof of IP ownership by the server. |
ip/get_client_ip¶
Returns the current IP address of the client making the request to the API.
HTTP-method: GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_client_ip |
| token | ✅ | string | Authorization token |
Example Request
Failure response
``` { "code": -1, "message": "authentication required" }
```
ip/get_ip¶
Returns full network configuration information for a specific IP address (mask, gateway, etc.)
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_ip |
| token | ✅ | string | Authorization token |
| ip | ✅ | string | IP address to retrieve information for |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "No data for the loopback address" }
```
ip/get_ptr¶
Checks whether the specified IP address belongs to a server with a given ID and returns the current PTR record for this IP in the specified location.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_ptr |
| token | ✅ | string | Authorization token |
| ip | ✅ | string | IP address |
| id | ✅ | int | Server ID |
| location | ❌ | string | Location for PTR check |
Example Request
Failure response
``` { "code": -1, "message": "invalid request" }
```
ip/get_traffic¶
Returns inbound and outbound traffic data for the specified IP address for the selected period. Can return both summary information and detailed timestamps.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| token | ✅ | string | Authorization token |
| ip | ✅ | string | IP address to retrieve traffic for |
| period_start | ❌ | int | Start of the period (timestamp) |
| period_stop | ❌ | int | End of the period (timestamp) |
| summary | ❌ | int | 1 - return only summary (in/out in GB), 0 - detailed timestamps |
| unbilled | ❌ | int | 1 - unpaid traffic only, 0 - all traffic |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "no significant traffic detected for [IP] in the period [DD-MM-YYYY] - [DD-MM-YYYY]" }
```
ip/list_free_ip¶
Returns a list of unused IPv4 addresses for a specific location based on Route Reflector tags. For clients, it is only available within their own subnets.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Action name (list_free_ip) |
| token | ✅ | string | Authorization token |
| exclude_special | ❌ | int | Exclude special addresses (0 or 1) |
| location | ✅ | string | Location to search for free IPs |
Example Request
Failure response
``` { "code": -1, "message": "illegal IP subnet" }
```
ip/set_main¶
Sets the specified IP address as the primary (main) for the server's network interface. Updates data in the WHMCS billing system if necessary.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: set_main |
| token | ✅ | string | Authentication token |
| id | ✅ | int | Server ID |
| ip | ✅ | string | IP address to set as main |
| main | ❌ | int | Main flag (0 for IPMI or 1 for IPv4) |
| description | ❌ | string | Description for the IP |
Example Request
Failure response
``` { "code": -1, "message": "invalid request or invalid IP for server id" }
```
ip/update_ptr¶
Updates the reverse DNS record (PTR) for the specified IP address. Requires permission verification and proof of IP ownership by the server.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: update_ptr |
| token | ✅ | string | Authorization token |
| ip | ✅ | string | IP address |
| id | ✅ | integer | Server ID |
| ptr | ✅ | string | New PTR record |
| location | ❌ | string | Location |
Example Request