ip.php¶
Module for managing IP addresses and network infrastructure: retrieving IP information, managing PTR records, tracking traffic, and working with subnets and VLANs.
API Methods¶
| Method | Action | Description |
|---|---|---|
get_client_ip | get client IP | Returns the current client's IP address |
get_ip | get IP information | Returns full information about a specific IP address (network, mask, etc.) |
get_ptr | get PTR record | Checks and returns the PTR record for the specified IP |
get_traffic | get traffic statistics | Returns incoming and outgoing traffic statistics for an IP over a specified period |
list_free_ip | list free IPs | Returns a list of available IP addresses for a specified location or subnet |
set_main | set main IP | Sets the specified IP as the primary IP for the server interface |
update_ptr | update PTR record | Updates the PTR record (reverse DNS) for the specified IP |
ip/get_client_ip¶
Returns the current client's IP address
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_client_ip |
| - | - | - | No other parameters |
ip/get_ip¶
Returns full information about a specific IP address (network, mask, etc.)
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_ip |
| token | ✅ | string | Authorization token |
| ip | ✅ | string | IP address to query |
| full | ❌ | boolean | Include full data in the response (data wrapper) |
Example Request
Example of a successful response
Failure response
{
"code": -1,
"message": "malformed IP=192.168.1.10 for token abc123",
"description": "Invalid IP address format"
}
ip/get_ptr¶
Checks and returns the PTR record for the specified IP
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_ptr |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| ip | ✅ | string | IP address |
| location | ❌ | string | Server location |
Example Request
Example of a successful response
ip/get_traffic¶
Returns incoming and outgoing traffic statistics for an IP over a specified period
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_traffic |
| token | ✅ | string | Authorization token |
| ip | ✅ | string | IP address |
| period_start | ❌ | integer | Period start (Unix timestamp) |
| period_stop | ❌ | integer | Period end (Unix timestamp) |
| summary | ❌ | integer | 1 - return summary only, 0 - return all ticks |
| unbilled | ❌ | integer | 1 - unbilled traffic only |
Example Request
Example of a successful response
Failure response
{
"code": -1,
"message": "no significant traffic detected for 192.168.1.10 in the period 01-01-2024 - 02-01-2024"
}
ip/list_free_ip¶
Returns a list of available IP addresses for a specified location or subnet
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: list_free_ip |
| token | ✅ | string | Authorization token |
| location | ❌ | string | Location code |
| id | ❌ | integer | Subnet ID (for clients) |
| exclude_special | ❌ | integer | Exclude special IPs |
Example Request
Example of a successful response
ip/set_main¶
Sets the specified IP as the primary IP for the server interface
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: set_main |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| ip | ✅ | string | IP address to set |
| main | ❌ | integer | Main IP flag (0/1) |
| description | ❌ | string | Action description |
Example Request
Example of a successful response
ip/update_ptr¶
Updates the PTR record (reverse DNS) for the specified IP
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: update_ptr |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| ip | ✅ | string | IP address |
| ptr | ✅ | string | New PTR value (domain name) |
| location | ❌ | string | Server location |
Example Request