/server/list_servers


GET https://api.sitehost.nz/1.3/server/list_servers.json

Lists all servers for a client.

Query Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client.Example: 1
filters[state]stringShow only servers in a specific state. Valid states are: On, Off or OtherExample: On
filters[type]stringShow only servers of a specific type.Example: VPS
filters[name]stringShow only servers whose name matches the specified string.Example: servername
filters[location]stringShow only servers at a specific location.Example: AIR
filters[location_node]stringShow servers on a specific location node.Example: NZ-AKL1-6JKW20
filters[product_type]stringShow only servers of a specific product type. LINVPS = Linux VPS WINVPS = Windows VPS CLHOST = Cloud Hosting CLDCON = Cloud Container VDSERV = Virtual Dedicated SERVER = Dedicated COLO = Colocated CLENT = Enterprise Cloud PCLOUD = Private CloudExample: LINVPS
filters[product_code]stringShow only servers using a specific product code.
filters[updated_since]stringShow only servers that have been modified on or after the specified date. Format is 'YYYY-MM-DD HH:MM:SS'.Example: 2023-01-01 13:30:00
filters[sort_by]stringThe field name to sort the results by.
filters[sort_dir]stringThe direction to sort in. Valid options are ASC and DESC
filters[page_size]integerThe number of items to return per page.
filters[page_number]integerThe page number to return.

Code Samples

JavaScript PHP Rails Python
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://api.sitehost.nz/1.3/server/list_servers.json?apikey=your_key_here&client_id=1&filters[state]=On&filters[type]=VPS&filters[name]=servername&filters[location]=AIR&filters[location_node]=NZ-AKL1-6JKW20&filters[product_type]=LINVPS&filters[updated_since]=2023-01-01+13%3A30%3A00", false);

xmlHttp.send();

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.3/server/list_servers.json?apikey=your_key_here&client_id=1&filters[state]=On&filters[type]=VPS&filters[name]=servername&filters[location]=AIR&filters[location_node]=NZ-AKL1-6JKW20&filters[product_type]=LINVPS&filters[updated_since]=2023-01-01+13%3A30%3A00");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'

uri = URI.parse("https://api.sitehost.nz/1.3/server/list_servers.json?apikey=your_key_here&client_id=1&filters[state]=On&filters[type]=VPS&filters[name]=servername&filters[location]=AIR&filters[location_node]=NZ-AKL1-6JKW20&filters[product_type]=LINVPS&filters[updated_since]=2023-01-01+13%3A30%3A00")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)
import requests

uri = 'https://api.sitehost.nz/1.3/server/list_servers.json?apikey=your_key_here&client_id=1&filters[state]=On&filters[type]=VPS&filters[name]=servername&filters[location]=AIR&filters[location_node]=NZ-AKL1-6JKW20&filters[product_type]=LINVPS&filters[updated_since]=2023-01-01+13%3A30%3A00'

response = requests.get(uri)

Response

200:

application/json
{
  "return": {
    "total_items": 1,
    "current_items": 1,
    "current_page": 1,
    "total_pages": 1,
    "data": [
      {
        "location": null,
        "product_code": "CLDCON1",
        "product_name": "Cloud Container - 1 Core",
        "product_type": "CLDCON",
        "client_id": "960001",
        "created": "2016-04-12 11:05:09",
        "date_updated": "2020-04-12 11:05:09",
        "name": "servername",
        "label": "My Server Label",
        "type": "VPS",
        "state": "On",
        "locked": "0",
        "rescue": "0",
        "disk": 5,
        "ram": "1",
        "distro": "ubuntu-trusty",
        "arch": "amd64",
        "os": "linux",
        "maint_date": "0000-00-00 00:00:00",
        "maint_date_end": "0000-00-00 00:00:00",
        "server_id": "31350",
        "disk_new": "0",
        "mirror": "0",
        "primary_ips": [
          {
            "prefix": "32",
            "ip_addr": "192.168.11.90"
          },
          {
            "prefix": "128",
            "ip_addr": "fc00:192:168:11::3b"
          }
        ]
      }
    ]
  },
  "msg": "Successful",
  "status": true
}