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, network, etc.) |
get_ptr | get PTR record | Checks whether the specified IP address belongs to the server with the 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 a selected period. Can return both summary information and detailed timestamps. |
list_free_ip | get list of free IPs | Returns a list of unused IP addresses for the specified location based on Route Reflector tags. Used by internal mechanisms to prevent scanning. |
set_main | set main IP for server | Sets the specified IP address as the primary (main) one for the server's network interface. |
update_ptr | update PTR record | Updates the reverse DNS record (PTR) for an IP address belonging to a server. 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, network, etc.)
HTTP-method: POST
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 the server with the given ID and returns the current PTR record for this IP in the specified location.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Action name (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 or IP not assigned to server" }
```
ip/get_traffic¶
Returns inbound and outbound traffic data for the specified IP address for a selected period. Can return both summary information and detailed timestamps.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_traffic |
| token | ✅ | string | Authentication token |
| ip | ✅ | string | IP address to report traffic for |
| period_start | ❌ | int | Start timestamp (default: current time - 86400) |
| period_stop | ❌ | int | End timestamp (default: current time) |
| summary | ❌ | int | 1 - return only summary {ip, in, out} in GB, 0 - all ticks with stamps for graphics |
| unbilled | ❌ | int | 1 - return only unbilled ticks, 0 - all ticks |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "no significant traffic detected for [ip] in the period [date] - [date]" }
```
ip/list_free_ip¶
Returns a list of unused IP addresses for the specified location based on Route Reflector tags. Used by internal mechanisms to prevent scanning.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Action name (list_free_ip) |
| token | ✅ | string | Authorization token |
| location | ❌ | string|int | Location to search for free IPs |
| exclude_special | ❌ | int | Exclude special IPs (0 or 1) |
Example Request
Failure response
``` { "code": -1, "message": "illegal IP subnet" }
```
ip/set_main¶
Sets the specified IP address as the primary (main) one for the server's network interface.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| token | ✅ | string | Authentication token |
| ip | ✅ | string | IP address to set as main |
| id | ✅ | int | Server ID |
| main | ❌ | string | Main parameter (e.g., 1 for main IPv4) |
| description | ❌ | string | Description for the IP |
Example Request
Failure response
``` { "code": -1, "message": "invalid IP 1.2.3.4 for server 123" }
```
ip/update_ptr¶
Updates the reverse DNS record (PTR) for an IP address belonging to a server. Requires permission verification and proof of IP ownership by the server.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Action name (update_ptr) |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| ip | ✅ | string | IP address |
| ptr | ✅ | string | PTR record (FQDN) |
| location | ❌ | string | Location |
Example Request