Virtual Servers API v1 Deprecated
Virtual Servers
The Virtual Servers resources are virtual servers you have running at LeaseWeb. This resource gives you control over each virtual server. You can reboot and shutdown the virtual server via this resource.
GEThttps://api.leaseweb.com/v1/virtualServersREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/virtualServers \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/virtualServers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("GET", "/v1/virtualServers", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/virtualServers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"virtualServers":
[
{
"id":156829,
"serverName":"LSWV030",
"reference":"vps1",
"administrativeInfo":{
"customerNumber":"1301178860",
"createdAt":"2013-08-14T00:00:00",
"startDate":"2013-10-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20130814185479"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,
"SLA":"Bronze - 24x7x4",
"ipAddresses": [
{
"ip": "85.17.214.125",
"isNulled": false,
"reverseDNS": "hosted.by.leaseweb.com"
},
{
"ip": "2001:1AF8:4100:A052:0024::",
"isNulled": false,
"reverseDNS": "hosted.by.leaseweb.com."
}
],
"type": {
"Id": 6,
"PlatformName": "Virtual Server"
},
"state":"Running",
"template":"Debian 7 64 40",
"attachedISO":null,
"macAddress":"06:ae:8c:00:00:1b"
},
{
"id":162342,
"serverName":"LSWV031",
"reference":null,
"administrativeInfo":{
"customerNumber":"1301178860",
"createdAt":"2013-10-14T11:53:00",
"startDate":"2013-11-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20131014189113"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,
"SLA":"Basic - 24x7x24",
"ipAddresses":{
"85.17.254.43":{
"isNulled":false,
"reverseDNS":"hosted-by.lea.com"
}
},
"state":"Running",
"template":"CentOS 6.5 64 40 20140904T1300",
"attachedISO":null,
"macAddress":"06:3a:50:00:00:d2"
},
{
"id":162343,
"serverName":"LSWV032",
"reference":null,
"administrativeInfo":{
"customerNumber":"1301178860",
"createdAt":"2013-10-14T11:53:00",
"startDate":"2013-11-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20131014189113"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,
"SLA":"Basic - 24x7x24",
"ipAddresses":{
"85.17.254.85":{
"isNulled":false,
"reverseDNS":"hosted-by.leaseweb.com."
}
},
"state":"Running",
"template":"CentOS 6 64 80 20140904T1300",
"attachedISO":null,
"macAddress":"06:0c:3c:00:00:02"
},
{
"id":163834,
"serverName":"LSWV033",
"reference":"My Webserver :)",
"administrativeInfo":{
"customerNumber":"1301178860",
"createdAt":"2013-10-28T11:20:00",
"startDate":"2013-11-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20131028190032"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,
"SLA":"Basic - 24x7x24",
"ipAddresses":{
"85.17.248.190":{
"isNulled":false,
"reverseDNS":"hosted-by.cloud.com."
},
"2001:1AF8:0018:0018::":{
"isNulled":false,
"reverseDNS":""
}
},
"state":"Running",
"template":"Ubuntu 14.04 amd64 60 GB",
"attachedISO":null,
"macAddress":"06:92:4c:00:00:1e"
},
{
"id":165811,
"serverName":"LSWV034",
"reference":null,
"administrativeInfo":{
"customerNumber":"1301178860",
"createdAt":"2013-11-14T08:01:00",
"startDate":"2013-12-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20131114191139"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,
"SLA":"Basic - 24x7x24",
"ipAddresses":{
"85.17.164.222":{
"isNulled":false,
"reverseDNS":"hosted-by.leaseweb.com."
}
},
"state":"Running",
"template":"CentOS 6.5 64 60 20140904T1300",
"attachedISO":null,
"macAddress":"06:15:a4:00:00:c4"
},
{
"id":167101,
"serverName":"LSWV035",
"reference":null,
"administrativeInfo":{
"customerNumber":"1301178860",
"createdAt":"2013-11-26T09:30:00",
"startDate":"2013-12-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20131126191866"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,
"SLA":"Basic - 24x7x24",
"ipAddresses":{
"85.17.248.14":{
"isNulled":false,
"reverseDNS":"hosted-by.leaseweb.com."
}
},
"state":"Stopped",
"template":"Windows 2012 R2STD 64 60 20150325T1025",
"attachedISO":null,
"macAddress":"06:79:a4:00:00:d3"
}
]
}
GETList your Virtual servers
To retrieve a list of all of your virtual servers, send a GET request to /v1/virtualServers.
The response will be a JSON object with key virtualServers containing an array of your virtual servers, each of which contain the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the virtual server resource |
| serverName | string | The name of the virtual serve |
| reference | string | A reference for the virtual server |
| administrativeInfo | object | Object containing administrative information |
| dataTrafficPack | string | Human-readable string for the datatraffic pack |
| dataTrafficLimit | integer | The datatraffic limit for the virtual server (in GB) |
| SLA | string | Human readable name of the SLA agreement |
| ipAddresses | object | Object containing an array of IP address information |
| type | object | Object containing information about the type of virtual server |
| state | string | State of the virtual server |
| template | string | Template used for the virtual server |
| attachedISO | string | Name of the ISO attached to the virtual server |
| macAddress | string | The MAC address of the virtual server |
The administrativeInfo object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| customerNumber | string | You customer number |
| createdAt | date | Date when the virtual server is created |
| startDate | date | Contractual date for the virtual server |
| endDate | date | Contractual end date for the virtual server |
| billingFrequency | string | Applied billing frequency |
| contractTerm | string | Applied contract term |
| orderNumber | string | The order number for the virtual server |
The ipAddresses object consists of array of IPs identified by IP having the following attributes:
| Name | Type | Description |
|---|---|---|
| isNulled | boolean | Whether the IP is nulled or not |
| reverseDNS | string | The reverse DNS value for the IP |
The type object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the virtual server type |
| PlatformName | string | Description of the virtual server type |
GEThttps://api.leaseweb.com/v1/virtualServers/1REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/virtualServers/1 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/virtualServers/1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("GET", "/v1/virtualServers/1", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/virtualServers/1")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"virtualServers": [
{
"id":156829,
"serverName":"LSWV030",
"reference":"vps1",
"administrativeInfo": {
"customerNumber":"1301111110",
"createdAt":"2013-08-14T00:00:00",
"startDate":"2013-10-01T00:00:00",
"endDate":null,
"billingFrequency":"1 month(s)",
"contractTerm":"1 month(s)",
"orderNumber":"20130814185479"
},
"dataTrafficPack":"Datatraffic - 500 GB (Premium)",
"dataTrafficLimit":500,"SLA":"Bronze - 24x7x4",
"ipAddresses": [
{
"ip": "85.17.214.125",
"isNulled": false,
"reverseDNS": "hosted.by.leaseweb.com"
},
{
"ip": "2001:1AF8:4100:A052:0024::",
"isNulled": false,
"reverseDNS": "hosted.by.leaseweb.com."
}
],
"type": {
"Id": 6,
"PlatformName": "Virtual Server"
},
"state":"Running",
"template":"Debian 7 64 40",
"attachedISO":null,
"macAddress":"06:ae:8c:00:00:1b"
}
]
}
GETRetrieve a Virtual server
To get information about a specific virtual server, send a GET request to /v1/virtualServers/{Id}.
The response will be a JSON object with key virtualServers containing the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the virtual server resource |
| serverName | string | The name of the virtual serve |
| reference | string | A reference for the virtual server |
| administrativeInfo | object | Object containing administrative information |
| dataTrafficPack | string | Human-readable string for the datatraffic pack |
| dataTrafficLimit | integer | The datatraffic limit for the virtual server (in GB) |
| SLA | string | Human readable name of the SLA agreement |
| ipAddresses | object | Object containing an array of IP address information |
| type | object | Object containing information about the type of virtual server |
| state | string | State of the virtual server |
| template | string | Template used for the virtual server |
| attachedISO | string | Name of the ISO attached to the virtual server |
| macAddress | string | The MAC address of the virtual server |
The administrativeInfo object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| customerNumber | string | You customer number |
| createdAt | date | Date when the virtual server is created |
| startDate | date | Contractual date for the virtual server |
| endDate | date | Contractual end date for the virtual server |
| billingFrequency | string | Applied billing frequency |
| contractTerm | string | Applied contract term |
| orderNumber | string | The order number for the virtual server |
The ipAddresses object consists of array of IPs identified by IP having the following attributes:
| Name | Type | Description |
|---|---|---|
| isNulled | boolean | Whether the IP is nulled or not |
| reverseDNS | string | The reverse DNS value for the IP |
The type object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the virtual server type |
| PlatformName | string | Description of the virtual server type |
POSThttps://api.leaseweb.com/v1/virtualServers/1/powerOnREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/virtualServers/1/powerOn \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/virtualServers/1/powerOn",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("POST", "/v1/virtualServers/1/powerOn", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/virtualServers/1/powerOn")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"asyncjob": {
"jobid": "cs01.534d6613-9b20-46b8-bd0d-c218f9480d55"
}
}
POSTPower on a Virtual server
To power on the virtual server, send a POST request request to /v1/virtualServers/{Id}/powerOn. Powering on the
virtual server is an asynchronous call, meaning the power on will be performed as soon as possible.
The response will be a HTTP 202 Accepted with a JSON object containing the folowing attribute:
| Name | Type | Description |
|---|---|---|
| jobid | string | An identifier for the asynchronous power on call |
POSThttps://api.leaseweb.com/v1/virtualServers/1/powerOffREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/virtualServers/1/powerOff \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/virtualServers/1/powerOff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("POST", "/v1/virtualServers/1/powerOff", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/virtualServers/1/powerOff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"asyncjob": {
"jobid": "cs01.534d6613-9b20-46b8-bd0d-c218f9480d55"
}
}
POSTPower off a Virtual server
To power off the virtual server, send a POST request request to /v1/virtualServers/{Id}/powerOff. Powering off the
virtual server is an asynchronous call, meaning the power off will be performed as soon as possible.
The response will be a HTTP 202 Accepted with a JSON object containing the folowing attribute:
| Name | Type | Description |
|---|---|---|
| jobid | string | An identifier for the asynchronous power off call |
POSThttps://api.leaseweb.com/v1/virtualServers/1/rebootREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/virtualServers/1/reboot \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/virtualServers/1/reboot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("POST", "/v1/virtualServers/1/reboot", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/virtualServers/1/reboot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"asyncjob": {
"jobid": "cs01.534d6613-9b20-46b8-bd0d-c218f9480d55"
}
}
POSTReboot a Virtual Server
To reboot the virtual server, send a POST request request to /v1/virtualServers/{Id}/reboot. The reboot call
is an asynchronous call, meaning the reboot will be performed as soon as possible.
The response will be a HTTP 202 Accepted with a JSON object containing the folowing attribute:
| Name | Type | Description |
|---|---|---|
| jobid | string | An identifier for the asynchronous reboot call |
POSThttps://api.leaseweb.com/v1/virtualServers/1/reinstallREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/virtualServers/1/reinstall \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/virtualServers/1/reinstall",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("POST", "/v1/virtualServers/1/reinstall", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/virtualServers/1/reinstall")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"asyncjob": {
"jobid": "cs01.534d6613-9b20-46b8-bd0d-c218f9480d55"
}
}
POSTReinstall a Virtual Server
To reinstall the virtual server, send a POST request request to /v1/virtualServers/{Id}/reinstall. The virtual server
will be reinstalled with the same operating system that it currently has. The reinstall call is an asynchronous call,
meaning the reinstall will be performed as soon as possible.
The response will be a HTTP 202 Accepted with a JSON object containing the folowing attribute:
| Name | Type | Description |
|---|---|---|
| jobid | string | An identifier for the asynchronous reinstall call |