Aller au contenu

presets.php

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

API Methods

Method Action Description
groups get groups Returns a list of available preset groups
info get preset information Returns a list of presets with prices in specified currencies, defaulting to EUR and USD
list get preset list Returns a list of available server presets with filtering by location and access rights
search search servers Searches for suitable servers for a specific preset by name, scope, and location.
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 (not required for public actions, but recommended for logging)

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=groups"
Example of a successful response
{
"result": "OK",
"action": "groups",
"groups": [
{
"id": 1,
"name": "Standard VPS",
"description": "Basic virtual servers"
}
]
}
Failure response

``` { "code": -1, "message": "Internal server error" }

```

presets/info

Returns a list of presets with prices in specified currencies, defaulting to EUR and USD

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: info
currencies string Comma-separated list of currencies (e.g., EUR,USD). Default: EUR,USD

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=info"
Example of a successful response
{
"result": "OK",
"action": "info",
"presets": [
{
"id": 1,
"name": "Basic VPS",
"cpu": 2,
"ram": 4096,
"hdd": 50,
"gpu": null,
"virtual": 1,
"active": 1,
"description": "Basic virtual server configuration",
"locations": "NL,DE",
"price": {
"EUR": 10.0,
"USD": 10.5
},
"monthly_usd": 10.5,
"monthly_com": 10.0,
"monthly_usd": 11.0
}
]
}
Failure response

``` { "code": -1, "message": "presets: 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 Filter by location (e.g., NL, DE). Default: '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,
"USD": 16.5
},
"monthly_usd": 16.5,
"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

Searches for suitable servers for a specific preset by name, scope, and location.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: search
token string User authorization token
name string Preset name to search for servers
scope string Scope (free/all). Default is an empty string.
location string Server location. Default: NL.

Example Request

curl -s "https://invapi.hostkey.com/presets.php" -X POST \
--data "action=search" \
--data "token=HOSTKEY_TOKEN"
Example of a successful response
{
"result": "OK",
"action": "search",
"servers": [
{
"id": 1024,
"server_id": 1024,
"type": "server",
"owner": "Rent",
"status": "sale",
"location": "NL",
"config": "Intel Xeon E5-2690 v4",
"full_location": "Rack1-1-1024",
"ip": "192.168.1.1",
"days_left": 30,
"due_date": "2024-12-31"
}
]
}
Failure response

``` { "code": -1, "message": "presets/search: invalid token, logout" }

```

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, 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_usd": 15,
"monthly_com": 1000,
"monthly_usd": 15,
"price": {
"EUR": 12.5,
"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_usd": 0.0083
}
]
}
Failure response

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