Անցնել պարունակությանը

presets.php

Server preset management module: retrieving lists, grouping, searching for suitable servers, and detailing configurations with prices in different currencies.

API Methods

Method Action Description
groups get groups Returns a list of available preset groups
info get currency info for presets Returns a list of available presets considering the selected currencies (default EUR, RUB)
list get presets list Returns a list of available server presets with filtering by location and access rights
search search servers Returns a list of servers matching the parameters of the specified preset. If the user is not authorized, the search is limited to free offers only.
show get preset Returns information about a preset by ID or name. Supports filtering and limits.

presets/groups

Returns a list of available preset groups

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: groups
token string Authorization token

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=groups" \
--data "token=7bc29eb23fb1b879b21fce509597f07c"
Example of a successful response
{
"result": "OK",
"action": "groups",
"data": [
{
"id": 1,
"name": "Standard Group"
},
{
"id": 2,
"name": "High Performance Group"
}
]
}
Failure response

``` { "code": -1, "message": "Internal Server Error" }

```

presets/info

Returns a list of available presets considering the selected currencies (default EUR, RUB)

HTTP-method: GET

Parameters:

Parameter Required Type Description
action string Method identifier: info
token string Authorization token
currencies string List of currencies separated by commas (e.g.: USD,EUR,RUB)

Example Request

curl -s "https://invapi.hostkey.com/presets.php?action=info&token=YOUR_TOKEN&currencies=USD,EUR" -X GET
Example of a successful response
{
"result": "OK",
"action": "info",
"presets": []
}
Failure response

``` { "code": -1, "message": "action required" }

```

presets/list

Returns a list of available server presets with filtering by location and access rights

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: list
token string Authorization token. If provided, access rights are checked. If not provided or invalid, public mode is used (the total field is removed).
location string Location filter (e.g., NL, DE). Default is 'NL'.

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=list"
Example of a successful response
{
"result": "OK",
"action": "list",
"presets": [
{
"id": 101,
"name": "VPS Basic",
"description": "Basic virtual server",
"cpu": 2,
"ram": 4096,
"hdd": 50,
"gpu": null,
"virtual": 1,
"active": 1,
"locations": "NL,DE",
"price": {
"EUR": 15.0,
"RUB": 1667.0,
"USD": 16.5
},
"monthly_ru": 1667,
"monthly_com": 15,
"monthly_usd": 16.5,
"internal": 0,
"available": 5,
"total": 10,
"server_type": "Virtual Private Server",
"tags": [
{
"component_id": 101,
"tag": "example_tag",
"value": "example_value"
}
]
}
]
}
Failure response

``` { "code": -1, "message": "presets/list error: Database connection failed", "details": { "action": "list", "module": "presets" } }

```

presets/search

Returns a list of servers matching the parameters of the specified preset. If the user is not authorized, the search is limited to free offers only.

HTTP-method: POST|GET

Parameters:

Parameter Required Type Description
action string Method identifier: search
token string User authorization token

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=search"
Example of a successful response
{
"result": "OK",
"action": "search",
"servers": [
{
"id": 123,
"name": "Standard Preset",
"days_left": 30,
"due_date": "2024-12-31T23:59:59Z"
}
]
}
Failure response

``` { "code": -1, "message": "Access denied or invalid token" }

```

presets/show

Returns information about a preset by ID or name. Supports filtering and limits.

HTTP-method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: show
token string Authorization token. If provided, it checks access rights and filters content (e.g., blocking for certain regions).
id integer Preset ID for filtering.
name string Preset name for filtering.
limit integer Limit on the number of returned records.

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=show"
Example of a successful response
{
"result": "OK",
"action": "show",
"presets": [
{
"id": 123,
"name": "Standard VPS",
"description": "Basic configuration",
"active": 1,
"virtual": 0,
"cpu": "2 vCPU",
"ram": "4096",
"hdd": "80 SSD",
"gpu": null,
"locations": "NL,DE",
"locations_openstack": "",
"monthly_ru": 556,
"monthly_com": 1000,
"monthly_usd": 15,
"price": {
"EUR": 12.5,
"RUB": 1389,
"USD": 15.0
},
"tags": [
{
"id": 1,
"name": "popular"
}
],
"internal": 0,
"server_type": "vps",
"available": 1,
"total": 10,
"regions": {
"NL": "10+",
"DE": "5"
},
"hourly_usd": 0.025,
"hourly_com": 0.02,
"hourly_ru": 0.0083
}
]
}
Failure response

``` { "code": -1, "message": "JSON encode failed" }

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×