Skip to content

node

Manage nodes

Create

Input parameters

ParameterTypeRequiredDetails
id
ID
Integer no

Node ID

Default: null

name
Name
String yes

Node name

Default: null

Validation rules
RuleDetails
Present

Must be supplied and cannot be null. Must not be empty; strings must contain a non-whitespace character.

Validation error message: must be present and non-empty

Format

Must match this regular expression:

\A[a-zA-Z0-9.\-_]+\z

null

Validation error message: invalid format

type
Role
String yes

node, storage or mailer

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • node
  • storage
  • mailer
  • dns_server

Validation error message: %{value} cannot be used

Present

Must be supplied and cannot be null. Must not be empty; strings must contain a non-whitespace character.

Validation error message: must be present and non-empty

hypervisor_type
Hypervisor type
String no

vpsadminos

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • vpsadminos

Validation error message: %{value} cannot be used

location
Location
Resource yes

Location node is placed in

ip_addr
IPv4 address
String yes

Node's IP address

Default: null

Validation rules
RuleDetails
Present

Must be supplied and cannot be null. Must not be empty; strings must contain a non-whitespace character.

Validation error message: must be present and non-empty

Format

Must match this regular expression:

\A\d+\.\d+\.\d+\.\d+\z

null

Validation error message: not a valid IPv4 address

max_tx
Max tx
Integer no

Maximum output throughput

Default: null

max_rx
Max tx
Integer no

Maximum input throughput

Default: null

cpus
Cpus
Integer no

Default: null

total_memory
Total_memory
Integer no

Default: null

total_swap
Total_swap
Integer no

Default: null

max_vps
Max_vps
Integer no

Default: null

maintenance
Maintenance
Boolean no

Put the node into maintenance mode

Default: null

Output parameters

ParameterTypeDescription
id
ID
Integer Node ID
active
Active
Boolean
name
Name
String Node name
domain_name
Domain name
String Node name including location domain
fqdn
FQDN
String
type
Role
String node, storage or mailer
hypervisor_type
Hypervisor type
String vpsadminos
location
Location
Resource Location node is placed in
ip_addr
IPv4 address
String Node's IP address
max_tx
Max tx
Integer Maximum output throughput
max_rx
Max tx
Integer Maximum input throughput
cpus
Cpus
Integer
total_memory
Total_memory
Integer
total_swap
Total_swap
Integer
max_vps
Max_vps
Integer
status
Status
Boolean
uptime
Uptime
Integer
loadavg1
Loadavg1
Float
loadavg5
Loadavg5
Float
loadavg15
Loadavg15
Float
process_count
Process count
Integer
cpu_user
Cpu_user
Float
cpu_nice
Cpu_nice
Float
cpu_system
Cpu_system
Float
cpu_idle
Cpu_idle
Float
cpu_iowait
Cpu_iowait
Float
cpu_irq
Cpu_irq
Float
cpu_softirq
Cpu_softirq
Float
cpu_guest
Cpu_guest
Float
used_memory
Used memory
Integer in MB
used_swap
Used swap
Integer in MB
arc_c_max
Arc_c_max
Integer
arc_c
Arc_c
Integer
arc_size
Arc_size
Integer
arc_hitpercent
Arc_hitpercent
Integer
version
Version
String 4 or 6
kernel
Kernel
String
cgroup_version
Cgroup version
String
pool_state
Pool_state
String
pool_scan
Pool_scan
String
pool_scan_percent
Pool_scan_percent
Float
pool_checked_at
Pool_checked_at
Datetime
pool_status
Pool_status
Boolean

Evacuate

Input parameters

ParameterTypeRequiredDetails
dst_node
Target node
Resource yes
stop_on_error
Stop on error
Boolean no

Default: true

maintenance_window
Maintenance_window
Boolean no

Run migrations in every VPS's maintenance window

Default: true

concurrency
Concurrency
Integer no

How many migrations run concurrently

Default: 1

cleanup_data
Cleanup_data
Boolean no

Default: true

send_mail
Send_mail
Boolean no

Default: true

reason
Reason
String no

Default: null

Output parameters

ParameterTypeDescription
migration_plan_id
Migration_plan_id
Integer

Index

Input parameters

ParameterTypeRequiredDetails
from_id
From ID
Integer no

List objects with IDs greater or lower than this value

Default: null

Validation rules
RuleDetails
Number
  • Must be a number after parameter type conversion.
  • Minimum: 0 (inclusive).

Validation error message: must be at least 0

limit
Limit
Integer no

Number of objects to retrieve

Default: null

Validation rules
RuleDetails
Number
  • Must be a number after parameter type conversion.
  • Minimum: 0 (inclusive).
  • Maximum: 1000 (inclusive).

Validation error message: must be between 0 and 1000

location
Location
Resource no

Location node is placed in

environment
Environment
Resource no
type
Role
String no

node, storage or mailer

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • node
  • storage
  • mailer
  • dns_server

Validation error message: %{value} cannot be used

hypervisor_type
Hypervisor type
String no

vpsadminos

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • vpsadminos

Validation error message: %{value} cannot be used

state
State
String no

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • all
  • active
  • inactive

Validation error message: %{value} cannot be used

Output parameters

ParameterTypeDescription
id
ID
Integer Node ID
active
Active
Boolean
name
Name
String Node name
domain_name
Domain name
String Node name including location domain
fqdn
FQDN
String
type
Role
String node, storage or mailer
hypervisor_type
Hypervisor type
String vpsadminos
location
Location
Resource Location node is placed in
ip_addr
IPv4 address
String Node's IP address
max_tx
Max tx
Integer Maximum output throughput
max_rx
Max tx
Integer Maximum input throughput
cpus
Cpus
Integer
total_memory
Total_memory
Integer
total_swap
Total_swap
Integer
max_vps
Max_vps
Integer
status
Status
Boolean
uptime
Uptime
Integer
loadavg1
Loadavg1
Float
loadavg5
Loadavg5
Float
loadavg15
Loadavg15
Float
process_count
Process count
Integer
cpu_user
Cpu_user
Float
cpu_nice
Cpu_nice
Float
cpu_system
Cpu_system
Float
cpu_idle
Cpu_idle
Float
cpu_iowait
Cpu_iowait
Float
cpu_irq
Cpu_irq
Float
cpu_softirq
Cpu_softirq
Float
cpu_guest
Cpu_guest
Float
used_memory
Used memory
Integer in MB
used_swap
Used swap
Integer in MB
arc_c_max
Arc_c_max
Integer
arc_c
Arc_c
Integer
arc_size
Arc_size
Integer
arc_hitpercent
Arc_hitpercent
Integer
version
Version
String 4 or 6
kernel
Kernel
String
cgroup_version
Cgroup version
String
pool_state
Pool_state
String
pool_scan
Pool_scan
String
pool_scan_percent
Pool_scan_percent
Float
pool_checked_at
Pool_checked_at
Datetime
pool_status
Pool_status
Boolean
maintenance_lock
Maintenance lock
String
maintenance_lock_reason
Maintenance reason
String

Examples

Examples use an initialized api client, authenticated when required. See initialization and authentication.

Example #0

Ruby · Simple
reply = api.node.index

# reply is an instance of HaveAPI::Client::ResourceInstanceList,
# which is a subclass of Array
Ruby · With error handling
begin
  require 'haveapi/client'

  api = HaveAPI::Client.new("https://api.vpsfree.cz/", version: "7.0")
  api.setup

  api.authenticate(:token, token: 'example-token')

  reply = api.node.index

  # reply is an instance of HaveAPI::Client::ResourceInstanceList,
  # which is a subclass of Array
rescue HaveAPI::Client::ValidationError => error
  warn error.message
  warn error.errors.inspect
rescue HaveAPI::Client::ActionFailed => error
  warn error.message
  warn error.response.errors.inspect if error.response.is_a?(HaveAPI::Client::Response)
rescue HaveAPI::Client::Authentication::AuthenticationFailed, HaveAPI::Client::ProtocolError,
       RestClient::Exception, JSON::ParserError => error
  warn error.message
end
JavaScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "index");
action.directInvoke({
  params: {},
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
JavaScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.authenticate("token", {token: "example-token"}, (api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "index");
    action.directInvoke({
      params: {},
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
JavaScript (async) · Simple
const result = await api.resource("node").action("index")({params: {}});
console.log(result.value);
JavaScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main() {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.authenticate("token", {token: "example-token"});
    const result = await api.resource("node").action("index")({params: {}});
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
TypeScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "index");
action.directInvoke({
  params: {},
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
TypeScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.authenticate("token", {token: "example-token"}, (api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "index");
    action.directInvoke({
      params: {},
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
TypeScript (async) · Simple
const result = await api.resource("node").action("index")({params: {}});
console.log(result.value);
TypeScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main(): Promise<void> {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.authenticate("token", {token: "example-token"});
    const result = await api.resource("node").action("index")({params: {}});
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
Python (sync) · Simple
response = api.resources["node"].actions["index"].call(params={})
print(response.data)
Python (sync) · With error handling
from haveapi_client import Client, ActionError, HaveAPIError, TokenAuth

try:
    with Client("https://api.vpsfree.cz/", version="7.0", auth=TokenAuth("example-token")) as api:
        response = api.resources["node"].actions["index"].call(params={})
        print(response.data)
        print(response.meta)
except ActionError as error:
    print(error.message, error.errors)
except HaveAPIError as error:
    print(error.message, error.status_code)
Python (async) · Simple
# Run inside an async function after initializing api.
response = await api.resources["node"].actions["index"].call(params={})
print(response.data)
Python (async) · With error handling
import asyncio

from haveapi_client import AsyncClient, ActionError, HaveAPIError, TokenAuth


async def main() -> None:
    try:
        async with AsyncClient("https://api.vpsfree.cz/", version="7.0", auth=TokenAuth("example-token")) as api:
            response = await api.resources["node"].actions["index"].call(params={})
            print(response.data)
            print(response.meta)
    except ActionError as error:
        print(error.message, error.errors)
    except HaveAPIError as error:
        print(error.message, error.status_code)


asyncio.run(main())
Go API client · Simple
invocation := api.Node.Index.Prepare()
invocation.NewInput().SelectParameters()
response, err := invocation.Call()
if err != nil {
	fmt.Println(err)
	return
}
if !response.Status {
	fmt.Println(response.Message, response.Errors)
	return
}
for _, item := range response.Output {
	if item != nil {
		fmt.Println(item.Id)
		fmt.Println(item.Name)
		fmt.Println(item.Type)
		if item.Location != nil {
			fmt.Println(item.Location.Id)
			fmt.Println(item.Location.Label)
		}
		fmt.Println(item.IpAddr)
		fmt.Println(item.MaintenanceLock)
	}
}
Rust API client (async) · Simple
// Use inside an async function returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().index().send().await?;
for item in &response.output {
    println!("{:?}", &item.id);
    println!("{:?}", &item.name);
    println!("{:?}", &item.type_);
    println!("{:?}", &item.location);
    println!("{:?}", &item.ip_addr);
    println!("{:?}", &item.maintenance_lock);
}
Rust API client (async) · With error handling
// cargo add vpsadmin-client
// cargo add tokio --features macros,rt-multi-thread
// cargo add serde_json
use vpsadmin_client::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .basic_auth("user", "secret")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().index().send().await {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    for item in &response.output {
        println!("{:?}", &item.id);
        println!("{:?}", &item.name);
        println!("{:?}", &item.type_);
        println!("{:?}", &item.location);
        println!("{:?}", &item.ip_addr);
        println!("{:?}", &item.maintenance_lock);
    }
    Ok(())
}
Rust API client (blocking) · Simple
// Use inside a synchronous function outside async runtime threads returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().index().send()?;
for item in &response.output {
    println!("{:?}", &item.id);
    println!("{:?}", &item.name);
    println!("{:?}", &item.type_);
    println!("{:?}", &item.location);
    println!("{:?}", &item.ip_addr);
    println!("{:?}", &item.maintenance_lock);
}
Rust API client (blocking) · With error handling
// cargo add vpsadmin-client --features blocking
// cargo add serde_json
// Construct, use and drop this blocking client outside async runtime threads.
use vpsadmin_client::blocking::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .basic_auth("user", "secret")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().index().send() {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    for item in &response.output {
        println!("{:?}", &item.id);
        println!("{:?}", &item.name);
        println!("{:?}", &item.type_);
        println!("{:?}", &item.location);
        println!("{:?}", &item.ip_addr);
        println!("{:?}", &item.maintenance_lock);
    }
    Ok(())
}
TypeScript API client · Simple
// Requires an initialized api and an async context.
const result = await api.node.index();
for (const item of result.data) {
  console.log(item.id);
  console.log(item.name);
  console.log(item.type);
  console.log(item.location);
  console.log(item.ip_addr);
  console.log(item.maintenance_lock);
}
TypeScript API client · With error handling
// Configured API client: vpsadmin-typescript-client.
import { AsyncClient, AsyncError } from "haveapi-client";
import { createClient } from "vpsadmin-typescript-client";

async function main(): Promise<void> {
  try {
    const runtime = new AsyncClient("https://api.vpsfree.cz/v7.0");
    await runtime.authenticate("basic", { user: "user", password: "secret" });
    const api = createClient({ execute: spec => runtime.request(spec) });
    const result = await api.node.index();
    void [result.data, result.meta, result.envelope, result.httpStatus];
    for (const item of result.data) {
      const value0: unknown = item.id;
      if (value0 !== null && value0 !== undefined) console.log(value0);
      const value1: unknown = item.name;
      if (value1 !== null && value1 !== undefined) console.log(value1);
      const value2: unknown = item.type;
      if (value2 !== null && value2 !== undefined) console.log(value2);
      const value3: unknown = item.location;
      if (value3 !== null && value3 !== undefined) console.log(value3);
      const value4: unknown = item.ip_addr;
      if (value4 !== null && value4 !== undefined) console.log(value4);
      const value5: unknown = item.maintenance_lock;
      if (value5 !== null && value5 !== undefined) console.log(value5);
    }
  } catch (error) {
    if (!(error instanceof AsyncError)) throw error;
    console.error(error.kind, error.httpStatus);
    throw error;
  }
}

main().catch(error => { throw error; });
PHP · Simple
$reply = $api->node->index();

// $reply is an instance of \HaveAPI\Client\ResourceInstanceList
PHP · With error handling
try {
    $api = new \HaveAPI\Client('https://api.vpsfree.cz/', '7.0');
    $api->setup();

    $api->authenticate('token', ['token' => 'example-token']);

    $reply = $api->node->index();

    // $reply is an instance of \HaveAPI\Client\ResourceInstanceList
} catch (\HaveAPI\Client\Exception\ValidationError $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\ActionFailed $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\Base $error) {
    echo $error->getMessage() . "\n";
} catch (\Exception $error) {
    // Dependency failures still propagate to the application.
    echo $error->getMessage() . "\n";
    throw $error;
}
CLI · Simple
$ haveapi-cli -u https://api.vpsfree.cz/ --version 7.0 node index
#                  ID:  1
#              Active:  -
#                Name:  node1
#         Domain name:  -
#                FQDN:  -
#                Role:  node
#     Hypervisor type:  -
#            Location:  The Location (#1)
#        IPv4 address:  192.168.0.10
#              Max tx:  -
#              Max tx:  -
#                Cpus:  -
#        Total_memory:  -
#          Total_swap:  -
#             Max_vps:  -
#              Status:  -
#              Uptime:  -
#            Loadavg1:  -
#            Loadavg5:  -
#           Loadavg15:  -
#       Process count:  -
#            Cpu_user:  -
#            Cpu_nice:  -
#          Cpu_system:  -
#            Cpu_idle:  -
#          Cpu_iowait:  -
#             Cpu_irq:  -
#         Cpu_softirq:  -
#           Cpu_guest:  -
#         Used memory:  -
#           Used swap:  -
#           Arc_c_max:  -
#               Arc_c:  -
#            Arc_size:  -
#      Arc_hitpercent:  -
#             Version:  -
#              Kernel:  -
#      Cgroup version:  -
#          Pool_state:  -
#           Pool_scan:  -
#   Pool_scan_percent:  -
#     Pool_checked_at:  -
#         Pool_status:  -
#    Maintenance lock:  no
#  Maintenance reason:  -
# 
curl · Simple
$ curl --request GET \
       --data-binary \{\"node\":\{\}\} \
       https://api.vpsfree.cz/v7.0/nodes

# {
#   "status": true,
#   "message": null,
#   "response": {
#     "nodes": [
#       {
#         "id": 1,
#         "name": "node1",
#         "type": "node",
#         "location": {
#           "id": 1,
#           "label": "The Location"
#         },
#         "ip_addr": "192.168.0.10",
#         "maintenance_lock": "no"
#       }
#     ]
#   },
#   "errors": null
# }
HTTP · Simple
GET /v7.0/nodes HTTP/1.1
Host: api.vpsfree.cz
Content-Type: application/json



HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: 335

{
  "status": true,
  "message": null,
  "response": {
    "nodes": [
      {
        "id": 1,
        "name": "node1",
        "type": "node",
        "location": {
          "id": 1,
          "label": "The Location"
        },
        "ip_addr": "192.168.0.10",
        "maintenance_lock": "no"
      }
    ]
  },
  "errors": null
}

Overview_list

Input parameters

No parameters.

Output parameters

ParameterTypeDescription
id
ID
Integer Node ID
active
Active
Boolean
name
Name
String Node name
domain_name
Domain name
String Node name including location domain
fqdn
FQDN
String
type
Role
String node, storage or mailer
hypervisor_type
Hypervisor type
String vpsadminos
location
Location
Resource Location node is placed in
ip_addr
IPv4 address
String Node's IP address
max_tx
Max tx
Integer Maximum output throughput
max_rx
Max tx
Integer Maximum input throughput
cpus
Cpus
Integer
total_memory
Total_memory
Integer
total_swap
Total_swap
Integer
max_vps
Max_vps
Integer
status
Status
Boolean
uptime
Uptime
Integer
loadavg1
Loadavg1
Float
loadavg5
Loadavg5
Float
loadavg15
Loadavg15
Float
process_count
Process count
Integer
cpu_user
Cpu_user
Float
cpu_nice
Cpu_nice
Float
cpu_system
Cpu_system
Float
cpu_idle
Cpu_idle
Float
cpu_iowait
Cpu_iowait
Float
cpu_irq
Cpu_irq
Float
cpu_softirq
Cpu_softirq
Float
cpu_guest
Cpu_guest
Float
used_memory
Used memory
Integer in MB
used_swap
Used swap
Integer in MB
arc_c_max
Arc_c_max
Integer
arc_c
Arc_c
Integer
arc_size
Arc_size
Integer
arc_hitpercent
Arc_hitpercent
Integer
version
Version
String 4 or 6
kernel
Kernel
String
cgroup_version
Cgroup version
String
pool_state
Pool_state
String
pool_scan
Pool_scan
String
pool_scan_percent
Pool_scan_percent
Float
pool_checked_at
Pool_checked_at
Datetime
pool_status
Pool_status
Boolean
last_report
Last report
Datetime
vps_running
Running VPS
Integer Number of running VPSes
vps_stopped
Stopped VPS
Integer Number of stopped VPSes
vps_deleted
Deleted VPS
Integer Number of lazily deleted VPSes
vps_total
Total VPS
Integer Total number of VPSes
vps_free
Free VPS slots
Integer Number of free VPS slots
vps_max
Max VPS slots
Integer Number of running VPSes
maintenance_lock
Maintenance lock
String
maintenance_lock_reason
Maintenance reason
String

Public_status

Input parameters

No parameters.

Output parameters

ParameterTypeDescription
id
Id
Integer Node ID
status
Status
Boolean
name
Node name
String Node name
fqdn
FQDN
String
location
Location
Resource Location node is placed in
last_report
Last report
Datetime
vps_count
VPS count
Integer
vps_free
Free VPS slots
Integer Number of free VPS slots
kernel
Kernel
String
type
Role
String node, storage or mailer
hypervisor_type
Hypervisor type
String vpsadminos
cpu_idle
CPU idle
Float
cgroup_version
Cgroup version
String
pool_state
Pool_state
String
pool_scan
Pool_scan
String
pool_scan_percent
Pool_scan_percent
Float
pool_checked_at
Pool_checked_at
Datetime
pool_status
Pool_status
Boolean
maintenance_lock
Maintenance lock
String
maintenance_lock_reason
Maintenance reason
String

Examples

Examples use an initialized api client, authenticated when required. See initialization and authentication.

Example #0

Ruby · Simple
reply = api.node.public_status

# reply is an instance of HaveAPI::Client::ResourceInstanceList,
# which is a subclass of Array
Ruby · With error handling
begin
  require 'haveapi/client'

  api = HaveAPI::Client.new("https://api.vpsfree.cz/", version: "7.0")
  api.setup

  reply = api.node.public_status

  # reply is an instance of HaveAPI::Client::ResourceInstanceList,
  # which is a subclass of Array
rescue HaveAPI::Client::ValidationError => error
  warn error.message
  warn error.errors.inspect
rescue HaveAPI::Client::ActionFailed => error
  warn error.message
  warn error.response.errors.inspect if error.response.is_a?(HaveAPI::Client::Response)
rescue HaveAPI::Client::Authentication::AuthenticationFailed, HaveAPI::Client::ProtocolError,
       RestClient::Exception, JSON::ParserError => error
  warn error.message
end
JavaScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "public_status");
action.directInvoke({
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
JavaScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.setup((api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "public_status");
    action.directInvoke({
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
JavaScript (async) · Simple
const result = await api.resource("node").action("public_status")();
console.log(result.value);
JavaScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main() {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.setup();
    const result = await api.resource("node").action("public_status")();
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
TypeScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "public_status");
action.directInvoke({
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
TypeScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.setup((api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "public_status");
    action.directInvoke({
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
TypeScript (async) · Simple
const result = await api.resource("node").action("public_status")();
console.log(result.value);
TypeScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main(): Promise<void> {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.setup();
    const result = await api.resource("node").action("public_status")();
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
Python (sync) · Simple
response = api.resources["node"].actions["public_status"].call()
print(response.data)
Python (sync) · With error handling
from haveapi_client import Client, ActionError, HaveAPIError

try:
    with Client("https://api.vpsfree.cz/", version="7.0") as api:
        response = api.resources["node"].actions["public_status"].call()
        print(response.data)
        print(response.meta)
except ActionError as error:
    print(error.message, error.errors)
except HaveAPIError as error:
    print(error.message, error.status_code)
Python (async) · Simple
# Run inside an async function after initializing api.
response = await api.resources["node"].actions["public_status"].call()
print(response.data)
Python (async) · With error handling
import asyncio

from haveapi_client import AsyncClient, ActionError, HaveAPIError


async def main() -> None:
    try:
        async with AsyncClient("https://api.vpsfree.cz/", version="7.0") as api:
            response = await api.resources["node"].actions["public_status"].call()
            print(response.data)
            print(response.meta)
    except ActionError as error:
        print(error.message, error.errors)
    except HaveAPIError as error:
        print(error.message, error.status_code)


asyncio.run(main())
Go API client · Simple
invocation := api.Node.PublicStatus.Prepare()
response, err := invocation.Call()
if err != nil {
	fmt.Println(err)
	return
}
if !response.Status {
	fmt.Println(response.Message, response.Errors)
	return
}
for _, item := range response.Output {
	if item != nil {
		fmt.Println(item.Status)
		fmt.Println(item.Name)
		if item.Location != nil {
			fmt.Println(item.Location.Id)
			fmt.Println(item.Location.Label)
		}
		fmt.Println(item.LastReport)
		fmt.Println(item.VpsCount)
		fmt.Println(item.VpsFree)
		fmt.Println(item.Kernel)
		fmt.Println(item.CpuIdle)
	}
}
Rust API client (async) · Simple
// Use inside an async function returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().public_status().send().await?;
for item in &response.output {
    println!("{:?}", &item.status);
    println!("{:?}", &item.name);
    println!("{:?}", &item.location);
    println!("{:?}", &item.last_report);
    println!("{:?}", &item.vps_count);
    println!("{:?}", &item.vps_free);
    println!("{:?}", &item.kernel);
    println!("{:?}", &item.cpu_idle);
    println!("{:?}", &item.maintenance_lock);
    println!("{:?}", &item.maintenance_lock_reason);
}
Rust API client (async) · With error handling
// cargo add vpsadmin-client
// cargo add tokio --features macros,rt-multi-thread
// cargo add serde_json
use vpsadmin_client::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().public_status().send().await {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    for item in &response.output {
        println!("{:?}", &item.status);
        println!("{:?}", &item.name);
        println!("{:?}", &item.location);
        println!("{:?}", &item.last_report);
        println!("{:?}", &item.vps_count);
        println!("{:?}", &item.vps_free);
        println!("{:?}", &item.kernel);
        println!("{:?}", &item.cpu_idle);
        println!("{:?}", &item.maintenance_lock);
        println!("{:?}", &item.maintenance_lock_reason);
    }
    Ok(())
}
Rust API client (blocking) · Simple
// Use inside a synchronous function outside async runtime threads returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().public_status().send()?;
for item in &response.output {
    println!("{:?}", &item.status);
    println!("{:?}", &item.name);
    println!("{:?}", &item.location);
    println!("{:?}", &item.last_report);
    println!("{:?}", &item.vps_count);
    println!("{:?}", &item.vps_free);
    println!("{:?}", &item.kernel);
    println!("{:?}", &item.cpu_idle);
    println!("{:?}", &item.maintenance_lock);
    println!("{:?}", &item.maintenance_lock_reason);
}
Rust API client (blocking) · With error handling
// cargo add vpsadmin-client --features blocking
// cargo add serde_json
// Construct, use and drop this blocking client outside async runtime threads.
use vpsadmin_client::blocking::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().public_status().send() {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    for item in &response.output {
        println!("{:?}", &item.status);
        println!("{:?}", &item.name);
        println!("{:?}", &item.location);
        println!("{:?}", &item.last_report);
        println!("{:?}", &item.vps_count);
        println!("{:?}", &item.vps_free);
        println!("{:?}", &item.kernel);
        println!("{:?}", &item.cpu_idle);
        println!("{:?}", &item.maintenance_lock);
        println!("{:?}", &item.maintenance_lock_reason);
    }
    Ok(())
}
TypeScript API client · Simple
// Requires an initialized api and an async context.
const result = await api.node.public_status();
for (const item of result.data) {
  console.log(item.status);
  console.log(item.name);
  console.log(item.location);
  console.log(item.last_report);
  console.log(item.vps_count);
  console.log(item.vps_free);
  console.log(item.kernel);
  console.log(item.cpu_idle);
  console.log(item.maintenance_lock);
  console.log(item.maintenance_lock_reason);
}
TypeScript API client · With error handling
// Configured API client: vpsadmin-typescript-client.
import { AsyncClient, AsyncError } from "haveapi-client";
import { createClient } from "vpsadmin-typescript-client";

async function main(): Promise<void> {
  try {
    const runtime = new AsyncClient("https://api.vpsfree.cz/v7.0");
    const api = createClient({ execute: spec => runtime.request(spec) });
    const result = await api.node.public_status();
    void [result.data, result.meta, result.envelope, result.httpStatus];
    for (const item of result.data) {
      const value0: unknown = item.status;
      if (value0 !== null && value0 !== undefined) console.log(value0);
      const value1: unknown = item.name;
      if (value1 !== null && value1 !== undefined) console.log(value1);
      const value2: unknown = item.location;
      if (value2 !== null && value2 !== undefined) console.log(value2);
      const value3: unknown = item.last_report;
      if (value3 !== null && value3 !== undefined) console.log(value3);
      const value4: unknown = item.vps_count;
      if (value4 !== null && value4 !== undefined) console.log(value4);
      const value5: unknown = item.vps_free;
      if (value5 !== null && value5 !== undefined) console.log(value5);
      const value6: unknown = item.kernel;
      if (value6 !== null && value6 !== undefined) console.log(value6);
      const value7: unknown = item.cpu_idle;
      if (value7 !== null && value7 !== undefined) console.log(value7);
      const value8: unknown = item.maintenance_lock;
      if (value8 !== null && value8 !== undefined) console.log(value8);
      const value9: unknown = item.maintenance_lock_reason;
      if (value9 !== null && value9 !== undefined) console.log(value9);
    }
  } catch (error) {
    if (!(error instanceof AsyncError)) throw error;
    console.error(error.kind, error.httpStatus);
    throw error;
  }
}

main().catch(error => { throw error; });
PHP · Simple
$reply = $api->node->public_status();

// $reply is an instance of \HaveAPI\Client\ResourceInstanceList
PHP · With error handling
try {
    $api = new \HaveAPI\Client('https://api.vpsfree.cz/', '7.0');
    $api->setup();

    $reply = $api->node->public_status();

    // $reply is an instance of \HaveAPI\Client\ResourceInstanceList
} catch (\HaveAPI\Client\Exception\ValidationError $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\ActionFailed $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\Base $error) {
    echo $error->getMessage() . "\n";
} catch (\Exception $error) {
    // Dependency failures still propagate to the application.
    echo $error->getMessage() . "\n";
    throw $error;
}
CLI · Simple
$ haveapi-cli -u https://api.vpsfree.cz/ --version 7.0 node public_status
#  Id  Status   Node name   FQDN   Location      Last report                  VPS count   Free VPS slots  Kernel                Role   Hypervisor type    CPU idle  Cgroup version   Pool_state   Pool_scan    Pool_scan_percent  Pool_checked_at   Pool_status   Maintenance lock   Maintenance reason 
#   -  true     node1.prg   -      Prague (#1)   2016-11-20T08:30:50+01:00           68               12  2.6.32-042stab120.6   -      -                      65.3  -                -            -                            -  -                 -             -                  -                  
#   -  -        node2.prg   -      Prague (#1)   2016-11-14T06:41:23+01:00            0               80  2.6.32-042stab120.6   -      -                     100.0  -                -            -                            -  -                 -             lock               HW upgrade         
#   -  true     node3.prg   -      Prague (#1)   2016-11-20T08:30:46+01:00           65               15  2.6.32-042stab120.6   -      -                      72.6  -                -            -                            -  -                 -             -                  -                  
curl · Simple
$ curl --request GET \
       --data-binary \{\"node\":null\} \
       https://api.vpsfree.cz/v7.0/nodes/public_status

# {
#   "status": true,
#   "message": null,
#   "response": {
#     "nodes": [
#       {
#         "status": true,
#         "name": "node1.prg",
#         "location": {
#           "id": 1,
#           "label": "Prague"
#         },
#         "last_report": "2016-11-20T08:30:50+01:00",
#         "vps_count": 68,
#         "vps_free": 12,
#         "kernel": "2.6.32-042stab120.6",
#         "cpu_idle": 65.3
#       },
#       {
#         "status": false,
#         "name": "node2.prg",
#         "location": {
#           "id": 1,
#           "label": "Prague"
#         },
#         "last_report": "2016-11-14T06:41:23+01:00",
#         "vps_count": 0,
#         "vps_free": 80,
#         "kernel": "2.6.32-042stab120.6",
#         "cpu_idle": 100.0,
#         "maintenance_lock": "lock",
#         "maintenance_lock_reason": "HW upgrade"
#       },
#       {
#         "status": true,
#         "name": "node3.prg",
#         "location": {
#           "id": 1,
#           "label": "Prague"
#         },
#         "last_report": "2016-11-20T08:30:46+01:00",
#         "vps_count": 65,
#         "vps_free": 15,
#         "kernel": "2.6.32-042stab120.6",
#         "cpu_idle": 72.6
#       }
#     ]
#   },
#   "errors": null
# }
HTTP · Simple
GET /v7.0/nodes/public_status HTTP/1.1
Host: api.vpsfree.cz
Content-Type: application/json



HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: 1135

{
  "status": true,
  "message": null,
  "response": {
    "nodes": [
      {
        "status": true,
        "name": "node1.prg",
        "location": {
          "id": 1,
          "label": "Prague"
        },
        "last_report": "2016-11-20T08:30:50+01:00",
        "vps_count": 68,
        "vps_free": 12,
        "kernel": "2.6.32-042stab120.6",
        "cpu_idle": 65.3
      },
      {
        "status": false,
        "name": "node2.prg",
        "location": {
          "id": 1,
          "label": "Prague"
        },
        "last_report": "2016-11-14T06:41:23+01:00",
        "vps_count": 0,
        "vps_free": 80,
        "kernel": "2.6.32-042stab120.6",
        "cpu_idle": 100.0,
        "maintenance_lock": "lock",
        "maintenance_lock_reason": "HW upgrade"
      },
      {
        "status": true,
        "name": "node3.prg",
        "location": {
          "id": 1,
          "label": "Prague"
        },
        "last_report": "2016-11-20T08:30:46+01:00",
        "vps_count": 65,
        "vps_free": 15,
        "kernel": "2.6.32-042stab120.6",
        "cpu_idle": 72.6
      }
    ]
  },
  "errors": null
}

Set_maintenance

Input parameters

ParameterTypeRequiredDetails
lock
Lock
Boolean yes

Default: null

Validation rules
RuleDetails
Present

Must be supplied and cannot be null. Must not be empty; strings must contain a non-whitespace character.

Validation error message: must be present and non-empty

reason
Reason
String no

Default: ""

Output parameters

No parameters.

Show

Input parameters

No parameters.

Output parameters

ParameterTypeDescription
id
ID
Integer Node ID
active
Active
Boolean
name
Name
String Node name
domain_name
Domain name
String Node name including location domain
fqdn
FQDN
String
type
Role
String node, storage or mailer
hypervisor_type
Hypervisor type
String vpsadminos
location
Location
Resource Location node is placed in
ip_addr
IPv4 address
String Node's IP address
max_tx
Max tx
Integer Maximum output throughput
max_rx
Max tx
Integer Maximum input throughput
cpus
Cpus
Integer
total_memory
Total_memory
Integer
total_swap
Total_swap
Integer
max_vps
Max_vps
Integer
status
Status
Boolean
uptime
Uptime
Integer
loadavg1
Loadavg1
Float
loadavg5
Loadavg5
Float
loadavg15
Loadavg15
Float
process_count
Process count
Integer
cpu_user
Cpu_user
Float
cpu_nice
Cpu_nice
Float
cpu_system
Cpu_system
Float
cpu_idle
Cpu_idle
Float
cpu_iowait
Cpu_iowait
Float
cpu_irq
Cpu_irq
Float
cpu_softirq
Cpu_softirq
Float
cpu_guest
Cpu_guest
Float
used_memory
Used memory
Integer in MB
used_swap
Used swap
Integer in MB
arc_c_max
Arc_c_max
Integer
arc_c
Arc_c
Integer
arc_size
Arc_size
Integer
arc_hitpercent
Arc_hitpercent
Integer
version
Version
String 4 or 6
kernel
Kernel
String
cgroup_version
Cgroup version
String
pool_state
Pool_state
String
pool_scan
Pool_scan
String
pool_scan_percent
Pool_scan_percent
Float
pool_checked_at
Pool_checked_at
Datetime
pool_status
Pool_status
Boolean
maintenance_lock
Maintenance lock
String
maintenance_lock_reason
Maintenance reason
String

Examples

Examples use an initialized api client, authenticated when required. See initialization and authentication.

Example #0

Ruby · Simple
reply = api.node.show(2)

# reply is an instance of HaveAPI::Client::ResourceInstance
# reply.id = 2
# reply.name = "node2"
# reply.type = "node"
# reply.location = HaveAPI::Client::ResourceInstance(resource: location, id: 1, label: "The Location")
# reply.ip_addr = "192.168.0.11"
# reply.maintenance_lock = "no"
Ruby · With error handling
begin
  require 'haveapi/client'

  api = HaveAPI::Client.new("https://api.vpsfree.cz/", version: "7.0")
  api.setup

  api.authenticate(:token, token: 'example-token')

  reply = api.node.show(2)

  # reply is an instance of HaveAPI::Client::ResourceInstance
  # reply.id = 2
  # reply.name = "node2"
  # reply.type = "node"
  # reply.location = HaveAPI::Client::ResourceInstance(resource: location, id: 1, label: "The Location")
  # reply.ip_addr = "192.168.0.11"
  # reply.maintenance_lock = "no"
rescue HaveAPI::Client::ValidationError => error
  warn error.message
  warn error.errors.inspect
rescue HaveAPI::Client::ActionFailed => error
  warn error.message
  warn error.response.errors.inspect if error.response.is_a?(HaveAPI::Client::Response)
rescue HaveAPI::Client::Authentication::AuthenticationFailed, HaveAPI::Client::ProtocolError,
       RestClient::Exception, JSON::ParserError => error
  warn error.message
end
JavaScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "show");
action.directInvoke(2, {
  params: {},
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
JavaScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.authenticate("token", {token: "example-token"}, (api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "show");
    action.directInvoke(2, {
      params: {},
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
JavaScript (async) · Simple
const result = await api.resource("node").action("show")(2, {params: {}});
console.log(result.value);
JavaScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main() {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.authenticate("token", {token: "example-token"});
    const result = await api.resource("node").action("show")(2, {params: {}});
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
TypeScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "show");
action.directInvoke(2, {
  params: {},
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
TypeScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.authenticate("token", {token: "example-token"}, (api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "show");
    action.directInvoke(2, {
      params: {},
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
TypeScript (async) · Simple
const result = await api.resource("node").action("show")(2, {params: {}});
console.log(result.value);
TypeScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main(): Promise<void> {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.authenticate("token", {token: "example-token"});
    const result = await api.resource("node").action("show")(2, {params: {}});
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
Python (sync) · Simple
response = api.resources["node"].actions["show"].call(path_params={"node_id": 2}, params={})
print(response.data)
Python (sync) · With error handling
from haveapi_client import Client, ActionError, HaveAPIError, TokenAuth

try:
    with Client("https://api.vpsfree.cz/", version="7.0", auth=TokenAuth("example-token")) as api:
        response = api.resources["node"].actions["show"].call(path_params={"node_id": 2}, params={})
        print(response.data)
        print(response.meta)
except ActionError as error:
    print(error.message, error.errors)
except HaveAPIError as error:
    print(error.message, error.status_code)
Python (async) · Simple
# Run inside an async function after initializing api.
response = await api.resources["node"].actions["show"].call(path_params={"node_id": 2}, params={})
print(response.data)
Python (async) · With error handling
import asyncio

from haveapi_client import AsyncClient, ActionError, HaveAPIError, TokenAuth


async def main() -> None:
    try:
        async with AsyncClient("https://api.vpsfree.cz/", version="7.0", auth=TokenAuth("example-token")) as api:
            response = await api.resources["node"].actions["show"].call(path_params={"node_id": 2}, params={})
            print(response.data)
            print(response.meta)
    except ActionError as error:
        print(error.message, error.errors)
    except HaveAPIError as error:
        print(error.message, error.status_code)


asyncio.run(main())
Go API client · Simple
invocation := api.Node.Show.Prepare()
invocation.SetPathParamInt("node_id", 2)
response, err := invocation.Call()
if err != nil {
	fmt.Println(err)
	return
}
if !response.Status {
	fmt.Println(response.Message, response.Errors)
	return
}
if response.Output != nil {
	fmt.Println(response.Output.Id)
	fmt.Println(response.Output.Name)
	fmt.Println(response.Output.Type)
	if response.Output.Location != nil {
		fmt.Println(response.Output.Location.Id)
		fmt.Println(response.Output.Location.Label)
	}
	fmt.Println(response.Output.IpAddr)
	fmt.Println(response.Output.MaintenanceLock)
}
Rust API client (async) · Simple
// Use inside an async function returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().show("2").send().await?;
println!("{:?}", &response.output.id);
println!("{:?}", &response.output.name);
println!("{:?}", &response.output.type_);
println!("{:?}", &response.output.location);
println!("{:?}", &response.output.ip_addr);
println!("{:?}", &response.output.maintenance_lock);
Rust API client (async) · With error handling
// cargo add vpsadmin-client
// cargo add tokio --features macros,rt-multi-thread
// cargo add serde_json
use vpsadmin_client::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .basic_auth("user", "secret")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().show("2").send().await {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    println!("{:?}", &response.output.id);
    println!("{:?}", &response.output.name);
    println!("{:?}", &response.output.type_);
    println!("{:?}", &response.output.location);
    println!("{:?}", &response.output.ip_addr);
    println!("{:?}", &response.output.maintenance_lock);
    Ok(())
}
Rust API client (blocking) · Simple
// Use inside a synchronous function outside async runtime threads returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().show("2").send()?;
println!("{:?}", &response.output.id);
println!("{:?}", &response.output.name);
println!("{:?}", &response.output.type_);
println!("{:?}", &response.output.location);
println!("{:?}", &response.output.ip_addr);
println!("{:?}", &response.output.maintenance_lock);
Rust API client (blocking) · With error handling
// cargo add vpsadmin-client --features blocking
// cargo add serde_json
// Construct, use and drop this blocking client outside async runtime threads.
use vpsadmin_client::blocking::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .basic_auth("user", "secret")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().show("2").send() {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    println!("{:?}", &response.output.id);
    println!("{:?}", &response.output.name);
    println!("{:?}", &response.output.type_);
    println!("{:?}", &response.output.location);
    println!("{:?}", &response.output.ip_addr);
    println!("{:?}", &response.output.maintenance_lock);
    Ok(())
}
TypeScript API client · Simple
// Requires an initialized api and an async context.
const result = await api.node.show({ "path": { "node_id": 2 } });
console.log(result.data.id);
console.log(result.data.name);
console.log(result.data.type);
console.log(result.data.location);
console.log(result.data.ip_addr);
console.log(result.data.maintenance_lock);
TypeScript API client · With error handling
// Configured API client: vpsadmin-typescript-client.
import { AsyncClient, AsyncError } from "haveapi-client";
import { createClient } from "vpsadmin-typescript-client";

async function main(): Promise<void> {
  try {
    const runtime = new AsyncClient("https://api.vpsfree.cz/v7.0");
    await runtime.authenticate("basic", { user: "user", password: "secret" });
    const api = createClient({ execute: spec => runtime.request(spec) });
    const result = await api.node.show({ "path": { "node_id": 2 } });
    void [result.data, result.meta, result.envelope, result.httpStatus];
    const item = result.data;
    const value0: unknown = item.id;
    if (value0 !== null && value0 !== undefined) console.log(value0);
    const value1: unknown = item.name;
    if (value1 !== null && value1 !== undefined) console.log(value1);
    const value2: unknown = item.type;
    if (value2 !== null && value2 !== undefined) console.log(value2);
    const value3: unknown = item.location;
    if (value3 !== null && value3 !== undefined) console.log(value3);
    const value4: unknown = item.ip_addr;
    if (value4 !== null && value4 !== undefined) console.log(value4);
    const value5: unknown = item.maintenance_lock;
    if (value5 !== null && value5 !== undefined) console.log(value5);
  } catch (error) {
    if (!(error instanceof AsyncError)) throw error;
    console.error(error.kind, error.httpStatus);
    throw error;
  }
}

main().catch(error => { throw error; });
PHP · Simple
$reply = $api->node->show(2);

// $reply is an instance of \HaveAPI\Client\ResourceInstance
// $reply->id = 2
// $reply->name = "node2"
// $reply->type = "node"
// $reply->location = \HaveAPI\Client\ResourceInstance(resource: location, id: 1, label: "The Location")
// $reply->ip_addr = "192.168.0.11"
// $reply->maintenance_lock = "no"
PHP · With error handling
try {
    $api = new \HaveAPI\Client('https://api.vpsfree.cz/', '7.0');
    $api->setup();

    $api->authenticate('token', ['token' => 'example-token']);

    $reply = $api->node->show(2);

    // $reply is an instance of \HaveAPI\Client\ResourceInstance
    // $reply->id = 2
    // $reply->name = "node2"
    // $reply->type = "node"
    // $reply->location = \HaveAPI\Client\ResourceInstance(resource: location, id: 1, label: "The Location")
    // $reply->ip_addr = "192.168.0.11"
    // $reply->maintenance_lock = "no"
} catch (\HaveAPI\Client\Exception\ValidationError $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\ActionFailed $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\Base $error) {
    echo $error->getMessage() . "\n";
} catch (\Exception $error) {
    // Dependency failures still propagate to the application.
    echo $error->getMessage() . "\n";
    throw $error;
}
CLI · Simple
$ haveapi-cli -u https://api.vpsfree.cz/ --version 7.0 node show 2
#                  ID:  2
#              Active:  -
#                Name:  node2
#         Domain name:  -
#                FQDN:  -
#                Role:  node
#     Hypervisor type:  -
#            Location:  The Location (#1)
#        IPv4 address:  192.168.0.11
#              Max tx:  -
#              Max tx:  -
#                Cpus:  -
#        Total_memory:  -
#          Total_swap:  -
#             Max_vps:  -
#              Status:  -
#              Uptime:  -
#            Loadavg1:  -
#            Loadavg5:  -
#           Loadavg15:  -
#       Process count:  -
#            Cpu_user:  -
#            Cpu_nice:  -
#          Cpu_system:  -
#            Cpu_idle:  -
#          Cpu_iowait:  -
#             Cpu_irq:  -
#         Cpu_softirq:  -
#           Cpu_guest:  -
#         Used memory:  -
#           Used swap:  -
#           Arc_c_max:  -
#               Arc_c:  -
#            Arc_size:  -
#      Arc_hitpercent:  -
#             Version:  -
#              Kernel:  -
#      Cgroup version:  -
#          Pool_state:  -
#           Pool_scan:  -
#   Pool_scan_percent:  -
#     Pool_checked_at:  -
#         Pool_status:  -
#    Maintenance lock:  no
#  Maintenance reason:  -
# 
curl · Simple
$ curl --request GET \
       --data-binary \{\"node\":\{\}\} \
       https://api.vpsfree.cz/v7.0/nodes/2

# {
#   "status": true,
#   "message": null,
#   "response": {
#     "node": {
#       "id": 2,
#       "name": "node2",
#       "type": "node",
#       "location": {
#         "id": 1,
#         "label": "The Location"
#       },
#       "ip_addr": "192.168.0.11",
#       "maintenance_lock": "no"
#     }
#   },
#   "errors": null
# }
HTTP · Simple
GET /v7.0/nodes/2 HTTP/1.1
Host: api.vpsfree.cz
Content-Type: application/json



HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: 300

{
  "status": true,
  "message": null,
  "response": {
    "node": {
      "id": 2,
      "name": "node2",
      "type": "node",
      "location": {
        "id": 1,
        "label": "The Location"
      },
      "ip_addr": "192.168.0.11",
      "maintenance_lock": "no"
    }
  },
  "errors": null
}

Update

Input parameters

ParameterTypeRequiredDetails
active
Active
Boolean no

Default: null

name
Name
String no

Node name

Default: null

Validation rules
RuleDetails
Format

Must match this regular expression:

\A[a-zA-Z0-9.\-_]+\z

null

Validation error message: invalid format

fqdn
FQDN
String no

Default: null

type
Role
String no

node, storage or mailer

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • node
  • storage
  • mailer
  • dns_server

Validation error message: %{value} cannot be used

hypervisor_type
Hypervisor type
String no

vpsadminos

Default: null

Validation rules
RuleDetails
Include

Allowed values:

  • vpsadminos

Validation error message: %{value} cannot be used

location
Location
Resource no

Location node is placed in

ip_addr
IPv4 address
String no

Node's IP address

Default: null

Validation rules
RuleDetails
Format

Must match this regular expression:

\A\d+\.\d+\.\d+\.\d+\z

null

Validation error message: not a valid IPv4 address

max_tx
Max tx
Integer no

Maximum output throughput

Default: null

max_rx
Max tx
Integer no

Maximum input throughput

Default: null

max_vps
Max_vps
Integer no

Default: null

Output parameters

No parameters.

Examples

Examples use an initialized api client, authenticated when required. See initialization and authentication.

Example #0

Ruby · Simple
reply = api.node.update(2, {name: "node2", type: "storage", location: 1, ip_addr: "192.168.0.11"})

# reply is an instance of HaveAPI::Client::ResourceInstance
Ruby · With error handling
begin
  require 'haveapi/client'

  api = HaveAPI::Client.new("https://api.vpsfree.cz/", version: "7.0")
  api.setup

  api.authenticate(:token, token: 'example-token')

  reply = api.node.update(2, {name: "node2", type: "storage", location: 1, ip_addr: "192.168.0.11"})

  # reply is an instance of HaveAPI::Client::ResourceInstance
rescue HaveAPI::Client::ValidationError => error
  warn error.message
  warn error.errors.inspect
rescue HaveAPI::Client::ActionFailed => error
  warn error.message
  warn error.response.errors.inspect if error.response.is_a?(HaveAPI::Client::Response)
rescue HaveAPI::Client::Authentication::AuthenticationFailed, HaveAPI::Client::ProtocolError,
       RestClient::Exception, JSON::ParserError => error
  warn error.message
end
JavaScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "update");
action.directInvoke(2, {
  params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"},
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
JavaScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.authenticate("token", {token: "example-token"}, (api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "update");
    action.directInvoke(2, {
      params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"},
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
JavaScript (async) · Simple
const result = await api.resource("node").action("update")(2, {params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"}});
console.log(result.value);
JavaScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main() {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.authenticate("token", {token: "example-token"});
    const result = await api.resource("node").action("update")(2, {params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"}});
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
TypeScript (callback) · Simple
const resource = CallbackClient.findResource(api, ["node"]);
const action = CallbackClient.findAction(resource, "update");
action.directInvoke(2, {
  params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"},
  onReply: (owner, reply) => {
    if (!reply.isOk()) {
      console.error(reply.message(), reply.envelope.errors);
      return;
    }
    console.log(reply.response());
  }
});
TypeScript (callback) · With error handling
import { CallbackClient } from "haveapi-client";

const api = new CallbackClient("https://api.vpsfree.cz/", {version: "7.0"});

api.authenticate("token", {token: "example-token"}, (api, ready) => {
  if (!ready) {
    console.error("Discovery or authentication failed");
    return;
  }
  try {
    const resource = CallbackClient.findResource(api, ["node"]);
    const action = CallbackClient.findAction(resource, "update");
    action.directInvoke(2, {
      params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"},
      onReply: (owner, reply) => {
        if (!reply.isOk()) {
          console.error(reply.message(), reply.envelope.errors);
          return;
        }
        console.log(reply.response());
        console.log(reply.meta());
      }
    });
  } catch (error) {
    console.error(error);
  }
});
TypeScript (async) · Simple
const result = await api.resource("node").action("update")(2, {params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"}});
console.log(result.value);
TypeScript (async) · With error handling
import { AsyncClient, AsyncError } from "haveapi-client";

async function main(): Promise<void> {
  const api = new AsyncClient("https://api.vpsfree.cz/", {version: "7.0"});
  try {
    await api.authenticate("token", {token: "example-token"});
    const result = await api.resource("node").action("update")(2, {params: {["name"]: "node2", ["type"]: "storage", ["location"]: 1, ["ip_addr"]: "192.168.0.11"}});
    console.log(result.value);
    console.log(result.response.meta);
  } catch (error) {
    if (error instanceof AsyncError) {
      console.error(error.kind, error.message, error.errors);
    } else {
      throw error;
    }
  }
}
main().catch(error => console.error(error));
Python (sync) · Simple
response = api.resources["node"].actions["update"].call(path_params={"node_id": 2}, params={"name": "node2", "type": "storage", "location": 1, "ip_addr": "192.168.0.11"})
print(response.data)
Python (sync) · With error handling
from haveapi_client import Client, ActionError, HaveAPIError, TokenAuth

try:
    with Client("https://api.vpsfree.cz/", version="7.0", auth=TokenAuth("example-token")) as api:
        response = api.resources["node"].actions["update"].call(path_params={"node_id": 2}, params={"name": "node2", "type": "storage", "location": 1, "ip_addr": "192.168.0.11"})
        print(response.data)
        print(response.meta)
except ActionError as error:
    print(error.message, error.errors)
except HaveAPIError as error:
    print(error.message, error.status_code)
Python (async) · Simple
# Run inside an async function after initializing api.
response = await api.resources["node"].actions["update"].call(path_params={"node_id": 2}, params={"name": "node2", "type": "storage", "location": 1, "ip_addr": "192.168.0.11"})
print(response.data)
Python (async) · With error handling
import asyncio

from haveapi_client import AsyncClient, ActionError, HaveAPIError, TokenAuth


async def main() -> None:
    try:
        async with AsyncClient("https://api.vpsfree.cz/", version="7.0", auth=TokenAuth("example-token")) as api:
            response = await api.resources["node"].actions["update"].call(path_params={"node_id": 2}, params={"name": "node2", "type": "storage", "location": 1, "ip_addr": "192.168.0.11"})
            print(response.data)
            print(response.meta)
    except ActionError as error:
        print(error.message, error.errors)
    except HaveAPIError as error:
        print(error.message, error.status_code)


asyncio.run(main())
Go API client · Simple
invocation := api.Node.Update.Prepare()
invocation.SetPathParamInt("node_id", 2)
input := invocation.NewInput().SelectParameters()
input.SetName("node2")
input.SetType("storage")
input.SetLocation(1)
input.SetIpAddr("192.168.0.11")
response, err := invocation.Call()
if err != nil {
	fmt.Println(err)
	return
}
if !response.Status {
	fmt.Println(response.Message, response.Errors)
	return
}
Rust API client (async) · Simple
// Use inside an async function returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().update("2").name("node2".to_owned()).type_("storage".to_owned()).location(1_i64).ip_addr("192.168.0.11".to_owned()).send().await?;
Rust API client (async) · With error handling
// cargo add vpsadmin-client
// cargo add tokio --features macros,rt-multi-thread
// cargo add serde_json
use vpsadmin_client::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .basic_auth("user", "secret")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().update("2").name("node2".to_owned()).type_("storage".to_owned()).location(1_i64).ip_addr("192.168.0.11".to_owned()).send().await {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    Ok(())
}
Rust API client (blocking) · Simple
// Use inside a synchronous function outside async runtime threads returning Result<(), Box<dyn std::error::Error>>.
let response = api.node().update("2").name("node2".to_owned()).type_("storage".to_owned()).location(1_i64).ip_addr("192.168.0.11".to_owned()).send()?;
Rust API client (blocking) · With error handling
// cargo add vpsadmin-client --features blocking
// cargo add serde_json
// Construct, use and drop this blocking client outside async runtime threads.
use vpsadmin_client::blocking::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = match Client::builder("https://api.vpsfree.cz/")
        .basic_auth("user", "secret")
        .build() {
        Ok(api) => api,
        Err(error) => {
            eprintln!("Client configuration failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let response = match api.node().update("2").name("node2".to_owned()).type_("storage".to_owned()).location(1_i64).ip_addr("192.168.0.11".to_owned()).send() {
        Ok(response) => response,
        Err(error) => {
            eprintln!("Request failed: {}", error);
            eprintln!("HTTP status: {:?}; timeout: {}", error.http_status(), error.is_timeout());
            return Err(error.into());
        }
    };
    let _ = response.http_status;
    let _ = &response.meta;
    Ok(())
}
TypeScript API client · Simple
// Requires an initialized api and an async context.
const result = await api.node.update({ "path": { "node_id": 2 }, "params": { "name": "node2", "type": "storage", "location": 1, "ip_addr": "192.168.0.11" } });
TypeScript API client · With error handling
// Configured API client: vpsadmin-typescript-client.
import { AsyncClient, AsyncError } from "haveapi-client";
import { createClient } from "vpsadmin-typescript-client";

async function main(): Promise<void> {
  try {
    const runtime = new AsyncClient("https://api.vpsfree.cz/v7.0");
    await runtime.authenticate("basic", { user: "user", password: "secret" });
    const api = createClient({ execute: spec => runtime.request(spec) });
    const result = await api.node.update({ "path": { "node_id": 2 }, "params": { "name": "node2", "type": "storage", "location": 1, "ip_addr": "192.168.0.11" } });
    void [result.data, result.meta, result.envelope, result.httpStatus];
    const item = result.data;
  } catch (error) {
    if (!(error instanceof AsyncError)) throw error;
    console.error(error.kind, error.httpStatus);
    throw error;
  }
}

main().catch(error => { throw error; });
PHP · Simple
$reply = $api->node->update(2, [
    'name' => 'node2',
    'type' => 'storage',
    'location' => 1,
    'ip_addr' => '192.168.0.11'
]);

// $reply is an instance of \HaveAPI\Client\ResourceInstance
PHP · With error handling
try {
    $api = new \HaveAPI\Client('https://api.vpsfree.cz/', '7.0');
    $api->setup();

    $api->authenticate('token', ['token' => 'example-token']);

    $reply = $api->node->update(2, [
        'name' => 'node2',
        'type' => 'storage',
        'location' => 1,
        'ip_addr' => '192.168.0.11'
    ]);

    // $reply is an instance of \HaveAPI\Client\ResourceInstance
} catch (\HaveAPI\Client\Exception\ValidationError $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\ActionFailed $error) {
    echo $error->getMessage() . "\n";
    print_r($error->getErrors());
} catch (\HaveAPI\Client\Exception\Base $error) {
    echo $error->getMessage() . "\n";
} catch (\Exception $error) {
    // Dependency failures still propagate to the application.
    echo $error->getMessage() . "\n";
    throw $error;
}
CLI · Simple
$ haveapi-cli -u https://api.vpsfree.cz/ --version 7.0 node update 2 -- \
              --name node2 \
              --type storage \
              --location 1 \
              --ip-addr 192.168.0.11
curl · Simple
$ curl --request PUT \
       --data-binary \{\"node\":\{\"name\":\"node2\",\"type\":\"storage\",\"location\":1,\"ip_addr\":\"192.168.0.11\"\}\} \
       https://api.vpsfree.cz/v7.0/nodes/2

# {
#   "status": true,
#   "message": null,
#   "response": {
#     "node": {}
#   },
#   "errors": null
# }
HTTP · Simple
PUT /v7.0/nodes/2 HTTP/1.1
Host: api.vpsfree.cz
Content-Type: application/json

{
  "node": {
    "name": "node2",
    "type": "storage",
    "location": 1,
    "ip_addr": "192.168.0.11"
  }
}

HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: 93

{
  "status": true,
  "message": null,
  "response": {
    "node": {}
  },
  "errors": null
}

Subresources