Bare Metals API v1 Deprecated
Bare Metal Servers
The Bare Metal Servers resources are bare metal servers you have running at LeaseWeb. This resource gives you control over each bare metal server. You can reboot and reinstall the server via this resource.
GEThttps://api.leaseweb.com/v1/bareMetalsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals",
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/bareMetals", 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/bareMetals")
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
{
"bareMetals": [
{
"bareMetal": {
"reference": null,
"bareMetalId": "24123",
"serverName": "ABD0211",
"serverType": "Bare Metal"
}
},
{
"bareMetal": {
"reference": null,
"bareMetalId": "28374",
"serverName": "ABD0212",
"serverType": "Bare Metal"
}
}
]
}
GETList Bare Metal servers
To retrieve a list of all of your bare metal servers, send a GET request to /v1/bareMetals.
The response will be a JSON object with key bareMetals containing an array of your bare metal servers, each of which contain the following attributes:
| Name | Type | Description |
|---|---|---|
| bareMetalId | string | The identifier of the bare metal resource |
| serverName | string | The name of the bare metal server |
| serverType | string | The type of the bare metal resource |
| reference | string | A reference for the bare metal server |
GEThttps://api.leaseweb.com/v1/bareMetals/12345REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345",
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/bareMetals/12345", 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/bareMetals/12345")
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
{
"bareMetal": {
"reference": null,
"location": {
"site": "AMS-01",
"cabinet": "18",
"rackspace": "-",
"combinationLock": "-"
},
"server": {
"ram": "2GB",
"kvm": "No",
"serverType": "Preinstalled evo-pbox18 ECR9130",
"processorType": "Amd Single-Core Sempron 2600+",
"processorSpeed": "1830 Mhz",
"numberOfCpus": 1,
"numberOfCores": 1,
"hardDisks": " 1x1TB ",
"hardwareRaid": "No"
},
"network": {
"dataPack": "Bandwidth (NL - Flat) - 500 Mbps (Volume)",
"ipmi": {
"gateway": "10.19.25.126",
"ip": "10.19.25.101",
"netmask": "255.255.255.192",
"network": "10.19.25.64",
"type": "ILO"
},
"ipsFreeOfCharge": "1",
"ipsAssigned": 1,
"excessIpsPrice": "0.00",
"dataPackExcess": {
"type": "",
"value": "0.00",
"unit": ""
},
"macAddresses": {
"mac": [
"00:13:D3:A8:2A:B2",
"00:13:D3:A8:2A:B3"
]
}
},
"extras": [],
"bareMetalId": "12345",
"serverName": "LSW - TEST",
"serverType": "Bare Metal",
"serverHostingPack": {
"reference": null,
"bareMetalId": "12345",
"serverName": "LSW - TEST",
"serverType": "Bare Metal",
"serverPrice": 60,
"startDate": "Feb 1, 2015",
"endDate": "",
"contractTerm": "1 year(s)"
},
"serverSpecifications": [],
"serviceLevelAgreement": {
"sla": "Basic - 24x7x24"
},
"datacenterAccessCards": {
"accessCards": [
"0",
[]
]
}
}
}
GETRetrieve a Bare Metal server
To get information about a specific bare metal servers, send a GET request to /v1/bareMetals/{bareMetalId}.
The response will be a JSON object contain the following attributes:
| Name | Type | Description |
|---|---|---|
| bareMetalId | integer | The identifier of the bare metal resource |
| serverName | string | The name of the bare metal server |
| serverType | string | The type of the bare metal resource |
| reference | string | A reference for the bare metal server |
| location | object | An object with location information |
| server | object | An object with server information |
| network | object | An object with network information |
| serverHostingPack | object | An object with pack information |
| serviceLevelAgreement | object | An object with SLA information |
| extras | object | DEPRICATED |
| serverSpecifications | object | DEPRICATED |
| datacenterAccessCards | object | DEPRICATED |
The location object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| site | string | The site where the bare metal server is located |
| cabinet | string | The cabinet the bare metal server is located in |
| rackspace | string | DEPRICATED |
| combinationLock | string | DEPRICATED |
The server object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| ram | string | The amount of RAM in the bare metal server |
| kvm | string | Flag to indicate KVM is available in the bare metal server (Yes/No) |
| serverType | string | Type of bare metal server |
| processorType | string | Processor type of the bare metal server |
| processorSpeed | string | Clock speed of the processor |
| numberOfCpus | integer | Number of processors in the bare metal server |
| numberOfCores | integer | Number of cores per processor |
| hardDisks | string | Amount and size of harddisks (eg: 1x1TB), comma separated |
| hardDiskList | array | Array of harddisks amount and size |
| hardwareRaid | string | Flag to indicate the bare metal server is equipped with hardware raid (Yes/No) |
The network object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| dataPack | string | Human readable name of the datapack |
| ipsFreeOfCharge | integer | Amount of IPs you can get with your bare metal server free of charge |
| ipsAssigned | integer | Amount of IPs assigned to the bare metal server |
| excessIpsPrice | float | Price per IP for extra IPs |
| dataPackExcess | object | An object with information about datapack over usage |
| ipmi | object | An object with IPMI information |
| macAddresses | array | An array with key mac containing all mac adresses of the bare metal server |
| pricePerMonth | float | Monthly price of the datapack |
The IPMI object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address of the IPMI device |
| netmask | string | Netmask of the IPMI device |
| network | string | Network address of the IPMI device |
| gateway | string | Gateway address of the IPMI device |
| type | string | Type of the IPMI device, either ILO or DRAC |
The dataPackExcess object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| type | string | The datapack type, either bandwidth or datatraffic |
| value | float | Price used for overusage calcaction per measurement unit |
| unit | string | Measuring unit used for overusage calculation |
The serverHostingPack object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| reference | string | Reference set for the bare metal server |
| bareMetalId | integer | The identifier of the bare metal resource |
| serverName | string | The name of the bare metal server |
| serverPrice | float | Monthly price of the bare metal server |
| serverType | string | The type of the bare metal resource |
| startDate | date | Bare metal contract start date |
| endDate | date | Bare metal contract end date |
| contractTerm | string | Applied contract term |
The serviceLevelAgreement object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| sla | string | Human readable name of the SLA agreement |
| pricePerMonth | float | Monthly price of the SLA agreement |
PUThttps://api.leaseweb.com/v1/bareMetals/12345REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/v1/bareMetals/12345 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data 'reference=My Reference'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "reference=My%20Reference",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "reference=My%20Reference"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("PUT", "/v1/bareMetals/12345", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/bareMetals/12345")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "reference=My%20Reference"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"bareMetal": {
"reference": null,
"location": {
"site": "AMS-01",
"cabinet": "18",
"rackspace": "-",
"combinationLock": "-"
},
"server": {
"ram": "2GB",
"kvm": "No",
"serverType": "Preinstalled evo-pbox18 ECR9130",
"processorType": "Amd Single-Core Sempron 2600+",
"processorSpeed": "1830 Mhz",
"numberOfCpus": 1,
"numberOfCores": 1,
"hardDisks": " 1x1TB ",
"hardwareRaid": "No"
},
"network": {
"dataPack": "Bandwidth (NL - Flat) - 500 Mbps (Volume)",
"ipmi": {
"gateway": "10.19.25.126",
"ip": "10.19.25.101",
"netmask": "255.255.255.192",
"network": "10.19.25.64",
"type": "ILO"
},
"ipsFreeOfCharge": "1",
"ipsAssigned": 1,
"excessIpsPrice": "0.00",
"dataPackExcess": {
"type": "",
"value": "0.00",
"unit": ""
},
"macAddresses": {
"mac": [
"00:13:D3:A8:2A:B2",
"00:13:D3:A8:2A:B3"
]
}
},
"extras": [],
"bareMetalId": "12345",
"serverName": "LSW - TEST",
"serverType": "Bare Metal",
"serverHostingPack": {
"reference": null,
"bareMetalId": "12345",
"serverName": "LSW - TEST",
"serverType": "Bare Metal",
"serverPrice": 60,
"startDate": "Feb 1, 2015",
"endDate": "",
"contractTerm": "1 year(s)"
},
"serverSpecifications": [],
"serviceLevelAgreement": {
"sla": "Basic - 24x7x24"
},
"datacenterAccessCards": {
"accessCards": [
"0",
[]
]
}
}
}
PUTUpdate a Bare Metal server
To update the reference of a bare metal server, send a PUT request to /v1/bareMetals/{bareMetalId}. The request
must contain the following form parameter:
| Name | Type | Description |
|---|---|---|
| reference | string | A new reference you want to set to the bare metal server |
The response will be a JSON object contain the following attributes:
| Name | Type | Description |
|---|---|---|
| bareMetalId | integer | The identifier of the bare metal resource |
| serverName | string | The name of the bare metal server |
| serverType | string | The type of the bare metal resource |
| reference | string | A reference for the bare metal server |
| location | object | An object with location information |
| server | object | An object with server information |
| network | object | An object with network information |
| serverHostingPack | object | An object with pack information |
| serviceLevelAgreement | object | An object with SLA information |
| extras | object | DEPRICATED |
| serverSpecifications | object | DEPRICATED |
| datacenterAccessCards | object | DEPRICATED |
The location object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| site | string | The site where the bare metal server is located |
| cabinet | string | The cabinet the bare metal server is located in |
| rackspace | string | DEPRICATED |
| combinationLock | string | DEPRICATED |
The server object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| ram | string | The amount of RAM in the bare metal server |
| kvm | string | Flag to indicate KVM is available in the bare metal server (Yes/No) |
| serverType | string | Type of bare metal server |
| processorType | string | Processor type of the bare metal server |
| processorSpeed | string | Clock speed of the processor |
| numberOfCpus | integer | Number of processors in the bare metal server |
| numberOfCores | integer | Number of cores per processor |
| hardDisks | string | Amount and size of harddisks (eg: 1x1TB), comma separated |
| hardDiskList | array | Array of harddisks amount and size |
| hardwareRaid | string | Flag to indicate the bare metal server is equipped with hardware raid (Yes/No) |
The network object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| dataPack | string | Human readable name of the datapack |
| ipsFreeOfCharge | integer | Amount of IPs you can get with your bare metal server free of charge |
| ipsAssigned | integer | Amount of IPs assigned to the bare metal server |
| excessIpsPrice | float | Price per IP for extra IPs |
| dataPackExcess | object | An object with information about datapack over usage |
| macAddresses | array | An array with key mac containing all mac adresses of the bare metal server |
| pricePerMonth | float | Monthly price of the datapack |
The dataPackExcess object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| type | string | The datapack type, either bandwidth or datatraffic |
| value | float | Price used for overusage calcaction per measurement unit |
| unit | string | Measuring unit used for overusage calculation |
The serverHostingPack object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| reference | string | Reference set for the bare metal server |
| bareMetalId | integer | The identifier of the bare metal resource |
| serverName | string | The name of the bare metal server |
| serverType | string | The type of the bare metal resource |
| startDate | date | Bare metal contract start date |
| endDate | date | Bare metal contract end date |
| contractTerm | string | Applied contract term |
The serviceLevelAgreement object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| sla | string | Human readable name of the SLA agreement |
| pricePerMonth | float | Monthly price of the SLA agreement |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/switchPortREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/switchPort \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/switchPort",
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/bareMetals/12345/switchPort", 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/bareMetals/12345/switchPort")
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
{
"switchPort": {
"status": "open",
"switchNode": 1,
"serverId": 1234,
"serverName": "My Server"
}
}
GETRetrieve switchport status
To retrieve the status of your switch port connected to your bare metal server, send
a GET request to /v1/bareMetals/{bareMetalId}/switchPort.
The response will be a JSON object with key switchPort containing the following attributes:
| Name | Type | Description |
|---|---|---|
| status | string | Indication whether the port is "open" or "closed" |
| serverId | integer | Bare metal server identiefier |
| serverName | string | Bare metal server name |
| switchNode | integer | Port identifier for this bare metal server |
POSThttps://api.leaseweb.com/v1/bareMetals/12345/switchPort/openREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/bareMetals/12345/switchPort/open \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/switchPort/open",
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/bareMetals/12345/switchPort/open", 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/bareMetals/12345/switchPort/open")
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
{
"switchPort": {
"status": "open",
"switchNode": 1,
"serverId": 1234,
"serverName": "My Server"
}
}
POSTOpen the switch port
To open the switch port connected to the bare metal server, send a POST request request to /v1/bareMetals/{bareMetalId}/switchPort/open.
The response will be a JSON object with key switchPort containing the following attributes:
| Name | Type | Description |
|---|---|---|
| status | string | Indication whether the port is "open" or "closed" |
| serverId | integer | Bare metal server identiefier |
| serverName | string | Bare metal server name |
| switchNode | integer | Port identifier for this bare metal server |
POSThttps://api.leaseweb.com/v1/bareMetals/12345/switchPort/closeREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/bareMetals/12345/switchPort/close \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/switchPort/close",
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/bareMetals/12345/switchPort/close", 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/bareMetals/12345/switchPort/close")
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
{
"switchPort": {
"status": "closed",
"switchNode": 1,
"serverId": 1234,
"serverName": "My Server"
}
}
POSTClose the switch port
To close the switch port connected to the bare metal server, send a POST request request to /v1/bareMetals/{bareMetalId}/switchPort/close.
The response will be a JSON object with key switchPort containing the following attributes:
| Name | Type | Description |
|---|---|---|
| status | string | Indication whether the port is "open" or "closed" |
| serverId | integer | Bare metal server identiefier |
| serverName | string | Bare metal server name |
| switchNode | integer | Port identifier for this bare metal server |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/powerStatusREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/powerStatus \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/powerStatus",
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/bareMetals/12345/powerStatus", 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/bareMetals/12345/powerStatus")
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
{
"powerStatus": {
"status": "on",
"serverId": 1234,
"serverName": "My Server"
}
}
GETRetrieve power status
To retrieve the power port status of your bare metal server, send
a GET request to /v1/bareMetals/{bareMetalId}/powerStatus.
The response will be a JSON object with key powerStatus containing the following attributes:
| Name | Type | Description |
|---|---|---|
| status | string | Indication whether the power port is "on" or "off" |
| serverId | integer | Bare metal server identiefier |
| serverName | string | Bare metal server name |
NOTE: Blade servers are not supported yet. We are doing our best to support it as soon as possible.
GEThttps://api.leaseweb.com/v1/bareMetals/12345/ipsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/ips \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/ips",
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/bareMetals/12345/ips", 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/bareMetals/12345/ips")
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
{
"ips": [
{
"ip": {
"ip": "4.3.2.1",
"reverseLookup": "hosted-by.leaseweb.com.",
"nullRouted": false,
"ipDetails": {
"gateway": "4.3.2.254",
"mask": "255.255.255.0"
},
"billingInformation": {
"startDate": "Feb 1, 2014",
"endDate": null,
"price": "0.00"
},
"serverId": "1234",
"serverType": "Bare Metal",
"serverName": "My Server"
}
}
]
}
GETBare Metal IPs
To retrieve a list of all of your bare metal server IPs, send a GET request to /v1/bareMetals/{bareMetalId}/ips.
The response will be a JSON object with key ips containing an array of your IPs, each of which contain the standard IP attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | The IP |
| reverseLookup | string | The reverse lookup set for the IP |
| nullRouted | boolean | Boolean to indicate if the IP is null-routed |
| serverId | integer | Identifier of the server using the IP |
| serverType | string | The type of server using the IP (Bare Metal, Cloud,...) |
| serverName | string | Name assigned to the server |
| ipDetails | object | Object containing information about netmask and gateway |
| billingInformation | object | Object containing information about billing |
The ipDetails object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| gateway | string | The gateway to be used for the IP resource |
| netmask | string | The reverse lookup set for the IP resource |
The billingInformation object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| price | string | Monthly price for the IP resource |
| startDate | string | The start date for the IP resource |
| endDate | string | The end date of the IP resource |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111",
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/bareMetals/12345/ips/85.17.96.111", 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/bareMetals/12345/ips/85.17.96.111")
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
{
"ip": {
"ip": "4.3.2.1",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"ipDetails": {
"gateway": "4.3.2.254",
"mask": "255.255.255.0"
},
"billingInformation": {
"startDate": "Feb 1, 2014",
"endDate": null,
"price": "0.00"
},
"serverId": "1234",
"serverType": "Bare Metal",
"serverName": "My Server"
}
}
GETRetrieve an IP
To retrieve a single IP resource for a bare metal server, send a GET request to /v1/bareMetals/1234/ips/{ipAddress}.
The response will be a JSON object with key ip containing the standard IP attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | The IP |
| reverseLookup | string | The reverse lookup set for the IP |
| nullRouted | boolean | Boolean to indicate if the IP is null-routed |
| serverId | integer | Identifier of the server using the IP |
| serverType | string | The type of server using the IP (Bare Metal, Cloud,...) |
| serverName | string | Name assigned to the server |
| ipDetails | object | Object containing information about netmask and gateway |
| billingInformation | object | Object containing information about billing |
The ipDetails object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| gateway | string | The gateway to be used for the IP resource |
| netmask | string | The reverse lookup set for the IP resource |
The billingInformation object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| price | string | Monthly price for the IP resource |
| startDate | string | The start date for the IP resource |
| endDate | string | The end date of the IP resource |
PUThttps://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data reverseLookup=my-reverse.hostname.com \
--data nullRouted=0
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "reverseLookup=my-reverse.hostname.com&nullRouted=0",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "reverseLookup=my-reverse.hostname.com&nullRouted=0"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("PUT", "/v1/bareMetals/12345/ips/85.17.96.111", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "reverseLookup=my-reverse.hostname.com&nullRouted=0"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ip": {
"ip": "4.3.2.1",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"ipDetails": {
"gateway": "4.3.2.254",
"mask": "255.255.255.0"
},
"billingInformation": {
"startDate": "Feb 1, 2014",
"endDate": null,
"price": "0.00"
},
"serverId": "1234",
"serverType": "Bare Metal",
"serverName": "My Server"
}
}
PUTUpdate an IP
To update the reverse lookup or to nullroute an IP for a bare metal server, send a PUT request to /v1/bareMetals/1234/ips/{ipAddress}.
The request should contain one of the following form parameters:
| Name | Type | Description |
|---|---|---|
| reverseLookup | string | The reverse lookup for the IP resource |
| nullRouted | boolean | A boolean indicating whether the IP should be nullrouted (0=false, 1=true) |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/networkUsageREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/networkUsage \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/networkUsage",
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/bareMetals/12345/networkUsage", 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/bareMetals/12345/networkUsage")
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
{
"bandwidth": {
"measurement": {
"node": {
"in": "-",
"out": "-",
"total": "44.85 Mbps"
},
"total": "44.85 Mbps",
"average": "44.85 Mbps"
},
"overusage": "0 bps",
"serverId": 1234,
"serverName": "My server",
"interval": {
"from": "11-06-2014",
"to": "10-07-2014"
},
"monthlyThreshold": "0 Mbps"
},
"dataTraffic": {
"measurement": {
"node": {
"in": "10.3 GB",
"out": "25.4 GB",
"total": "35.7 GB"
},
"total": "35.7 GB"
},
"overusage": "0 B",
"serverId": 1234,
"serverName": "My server",
"interval": {
"from": "01-01-2014",
"to": "10-06-2014"
},
"monthlyThreshold": "0 GB"
}
}
GETRetrieve network usage
To retrieve the network usage of your bare metal server, send
a GET request to /v1/bareMetals/{bareMetalId}/networkUsage.
You can use the following querystring paramaters:
| Name | Type | Description |
|---|---|---|
| dateFrom | string | Start date of the usage calculation, format: DD-MM-YYYY |
| dateTo | string | End date of the usage calculation, format: DD-MM-YYYY |
The response will be a JSON object containing the following attributes:
| Name | Type | Description |
|---|---|---|
| bandwidth | object | Object with bandwidth information |
| datatraffic | obect | Object with datatraffic information |
Both the bandwidth object and the datatraffic object contain the following attributes:
| Name | Type | Description |
|---|---|---|
| measurement | object | Object containing measurement information |
| overusage | string | Amount of overusage including the unit, for example: "1.2 Mbps" |
| serverId | integer | Bare metal server identifier |
| serverName | string | Bare metal server name |
| interval | object | Object containg the measurement date range information |
| monthlyThreshold | string |
The measurement object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| node | object | Small object with attributes "in", "out" and "total" representing the usage per measured network port |
| total | string | Totale usage over the given interval |
| average | string | Average bandwidth usage over the given interval. Only for bandwidth measurements. |
The interval object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| from | string | Start date of the measurement |
| to | string | End date of the measurement |
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| dateFrom | Start date for the network Usage calculation | |
| dateTo | End date for the network Usage calculation |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/networkUsage/bandwidthREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/bandwidth \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/bandwidth",
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/bareMetals/12345/networkUsage/bandwidth", 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/bareMetals/12345/networkUsage/bandwidth")
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
GETRetrieve bandwidth usage
To retrieve the bandwidth usage of your bare metal server, send
a GET request to /v1/bareMetals/{bareMetalId}/networkUsage/bandwidth.
You can use the following querystring paramaters:
| Name | Type | Description |
|---|---|---|
| dateFrom | string | Start date of the usage calculation, format: DD-MM-YYYY |
| dateTo | string | End date of the usage calculation, format: DD-MM-YYYY |
You can also send an Accept header with values application/json for JSON response or image/png to retrieve
the bandwidth as an image.
The response will be a JSON object with key bandwidth containing the following attributes:
| Name | Type | Description |
|---|---|---|
| measurement | object | Object containing measurement information |
| overusage | string | Amount of overusage including the unit, for example: "1.2 Mbps" |
| serverId | integer | Bare metal server identifier |
| serverName | string | Bare metal server name |
| interval | object | Object containg the measurement date range information |
| monthlyThreshold | string |
The measurement object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| node | object | Small object with attributes "in", "out" and "total" representing the usage per measured network port |
| total | string | Totale usage over the given interval |
| average | string | Average bandwidth usage over the given interval |
The interval object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| from | string | Start date of the measurement |
| to | string | End date of the measurement |
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| dateFrom | Start date for the network Usage calculation | |
| dateTo | End date for the network Usage calculation |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/networkUsage/datatrafficREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/datatraffic \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/datatraffic",
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/bareMetals/12345/networkUsage/datatraffic", 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/bareMetals/12345/networkUsage/datatraffic")
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
GETRetrieve datatraffic usage
To retrieve the datatraffc used by your bare metal server, send
a GET request to /v1/bareMetals/{bareMetalId}/networkUsage/datatraffic.
You can use the following querystring paramaters:
| Name | Type | Description |
|---|---|---|
| dateFrom | string | Start date of the usage calculation, format: DD-MM-YYYY |
| dateTo | string | End date of the usage calculation, format: DD-MM-YYYY |
You can also send an Accept header with values application/json for JSON response or image/png to retrieve
the bandwidth as an image.
The response will be a JSON object with key bandwidth containing the following attributes:
| Name | Type | Description |
|---|---|---|
| measurement | object | Object containing measurement information |
| overusage | string | Amount of overusage including the unit, for example: "1.2 Mbps" |
| serverId | integer | Bare metal server identifier |
| serverName | string | Bare metal server name |
| interval | object | Object containg the measurement date range information |
| monthlyThreshold | string |
The measurement object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| node | object | Small object with attributes "in", "out" and "total" representing the usage per measured network port |
| total | string | Totale usage over the given interval |
The interval object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| from | string | Start date of the measurement |
| to | string | End date of the measurement |
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| dateFrom | Start date for the network Usage calculation | |
| dateTo | End date for the network Usage calculation |
POSThttps://api.leaseweb.com/v1/bareMetals/12345/powerCycleREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/bareMetals/12345/powerCycle \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/powerCycle",
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/bareMetals/12345/powerCycle", 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/bareMetals/12345/powerCycle")
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
{}
POSTReboot a server
To reboot the bare metal server, send a POST request request to /v1/bareMetals/{bareMetalId}/powerCycle.
The response will be a HTTP 202 OK.
POSThttps://api.leaseweb.com/v1/bareMetals/12345/installREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/bareMetals/12345/install \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data osId=138 \
--data 'hdd={??}
' \
--data raidLevel=1 \
--data numberDisks=3
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/install",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("POST", "/v1/bareMetals/12345/install", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/bareMetals/12345/install")
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'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
POSTLaunch a re-installation
To re-install the bare metal server with a new operating system, send a POST request request to /v1/bareMetals/{bareMetalId}/install.
The request should contain the following form parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| osId | integer | true | The operating system Id |
| hdd | object | false | The hdd partition schema. |
| raidLevel | integer | false | The SW RAID level i.e. 0, 1, 5, 6, 10. |
| numberDisks | integer | false | The number of disks you want to apply SW RAID on. |
The hdd schema object has three elements: 1: disk (string) – The disk name (eg: /dev/sda) 2: params (array) – Partition list schemes 3: bootable (integer) – Index of the bootable partition (eg: 0)
Params is a numeric key base array from “0” to the number of partitions you want to create. Each with the following elements: 1: type (string) – The filesystem type (eg: ext3) 2: size (integer) – Size of the partition in MB (eg: 10000) 3: mountpoint (string) – The partition mount point (eg: /home). This is mandatory for the root partition (“/”) |
The response will be a HTTP 200 OK.
The status of the installation or password can be requested by doing a GET request to /v1/bareMetals/{bareMetalId}/installationStatus.
POSThttps://api.leaseweb.com/v1/bareMetals/12345/rescueModeREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/bareMetals/12345/rescueMode \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data osId=138
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/rescueMode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "osId=138",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "osId=138"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("POST", "/v1/bareMetals/12345/rescueMode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/bareMetals/12345/rescueMode")
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'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "osId=138"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
POSTLaunch rescue mode
To re-install the bare metal server with a new operating system, send a POST
request request to /v1/bareMetals/{bareMetalId}/rescueMode.
The request should contain the following form parameters:
| Name | Type | Description |
|---|---|---|
| osId | integer | The operating system Id |
The response will be a HTTP 200 OK.
The status of the rescue mode can be requested by doing a GET request to
/v1/bareMetals/{bareMetalId}/installationStatus.
To fetch the rescue mode password do a GET request to
/v1/bareMetals/{bareMetalId}/rootPassword. The rescue mode password will be
available (or updated) as soon as the rescue mode is launched succesfully.
GEThttps://api.leaseweb.com/v1/bareMetals/12345/rootPasswordREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/rootPassword \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/rootPassword",
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/bareMetals/12345/rootPassword", 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/bareMetals/12345/rootPassword")
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
{
"rootPassword": "super-secret",
"rescueModePassword": "other-password"
}
GETRetrieve root password
To retrieve the initial the bare metal serverroot password, send a GET request request to /v1/bareMetals/{bareMetalId}/rootPassword.
The response will be a JSON object with the following attribute:
| Name | Type | Description |
|---|---|---|
| rootpassword | string | The initial root password |
| rescueModePassword | string | The rescue mode root password |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/installationStatusREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/installationStatus \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/installationStatus",
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/bareMetals/12345/installationStatus", 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/bareMetals/12345/installationStatus")
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
{
"installationStatus": {
"code": 1000,
"description": "Normal",
"serverPackId": "1234",
"serverName": "My_Server"
}
}
GETRetrieve installation status
To retrieve the status of a requested installation, send a GET request request to /v1/bareMetals/{bareMetalId}/installationStatus.
The response will be a JSON object with key installationStatus, containing the following attributes:
| Name | Type | Description |
|---|---|---|
| code | integer | Success code (normally 1000) |
| description | string | Status of the installation or server. Normal indicates server is not being installed at the moment and operates as normal |
| serverPackId | integer | Identifier of the bare metal server |
| serverPackName | string | Name of the bare metal server |
GEThttps://api.leaseweb.com/v1/bareMetals/12345/leasesREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/leases \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases",
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/bareMetals/12345/leases", 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/bareMetals/12345/leases")
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
[
{
"_metadata": {
"totalCount": 1,
"limit": 10,
"offset": 0
},
"leases": [
{
"ip": "192.168.0.100",
"mac": "68:B5:99:CE:E3:01",
"options": [
{
"name": "Bootfile Name",
"optionId": "67",
"policyName": null,
"type": "String",
"userClass": "",
"value": "undionly.kpxe",
"vendorClass": ""
},
{
"name": "DNS Servers",
"optionId": "6",
"policyName": null,
"type": "IPv4Address",
"userClass": "",
"value": "8.8.8.8, 8.8.8.4",
"vendorClass": ""
},
{
"name": "Boot Server Host Name",
"optionId": "66",
"policyName": null,
"type": "String",
"userClass": "",
"value": "192.168.0.150",
"vendorClass": ""
},
{
"name": "Bootfile Name",
"optionId": "67",
"policyName": null,
"type": "String",
"userClass": "gPXE",
"value": "http://95.211.51.8/server/getPxeConfig/serverId/11895/key/bf59bdac764fe8ab62646fce063d8429",
"vendorClass": ""
}
],
"scope": "192.168.0.64"
}
]
}
]
GETRetrieve a list of DHCP leases
To retrieve a list of DHCP leases, send a GET request to /v1/bareMetals/{bareMetalId}/leases.
The response will be a JSON object with key leases containing the following attribute:
| Name | Type | Description |
|---|---|---|
| ip | string | The assigned IP for the DHCP lease |
| mac | string | The MAC address the DHCP lease is assigned to |
| scope | string | The scope of the DHCP lease |
| options | object | An object of DHCP lease options |
The options object is an array of DHCP lease options, each of which contains the following attributes:
| Name | Type | Description |
|---|---|---|
| name | string | Name of the DHCP option |
| optionId | string | DHCP option identifier |
| policyName | string | DHCP option policy name |
| type | string | DHCP option type |
| userClass | string | DHCP option user class |
| value | string | Value used for the DHCP option |
| vendorClass | string | DHCP option vendor class |
POSThttps://api.leaseweb.com/v1/bareMetals/12345/leasesREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/bareMetals/12345/leases \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data bootFileName=http://get.myinstallation.pxe/123 \
--data bootServerHostName=92.168.0.230 \
--data domainNameServerIp=8.8.8.8
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "bootFileName=http%3A%2F%2Fget.myinstallation.pxe%2F123&bootServerHostName=92.168.0.230&domainNameServerIp=8.8.8.8",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "bootFileName=http%3A%2F%2Fget.myinstallation.pxe%2F123&bootServerHostName=92.168.0.230&domainNameServerIp=8.8.8.8"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("POST", "/v1/bareMetals/12345/leases", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/bareMetals/12345/leases")
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'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "bootFileName=http%3A%2F%2Fget.myinstallation.pxe%2F123&bootServerHostName=92.168.0.230&domainNameServerIp=8.8.8.8"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
No Content
POSTCreate a new DHCP lease
To create a new DHCP leases, send a POST request request to /v1/bareMetals/{bareMetalId}/leases.
The request must contain the following form parameters:
| Name | Type | Description |
|---|---|---|
| bootFileName | string | The URL of PXE boot you want your server to boot from |
| bootServerHostName | string | The TFTP server ip where to download the operating system image |
| domainNameServerIp | string | The Domain Name Server IP used |
On success the reponse will be a HTTP 204 No Content.
DELETEhttps://api.leaseweb.com/v1/bareMetals/12345/leasesREQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/v1/bareMetals/12345/leases \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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("DELETE", "/v1/bareMetals/12345/leases", 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/bareMetals/12345/leases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
No Content
DELETEDelete all DHCP leases
To delete a DHCP lease resource, send a DELETE request request to /v1/bareMetals/{bareMetalId}/leases.
On success the reponse will be a HTTP 204 No Content.
GEThttps://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01",
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/bareMetals/12345/leases/28:B5:99:CE:E3:01", 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/bareMetals/12345/leases/28:B5:99:CE:E3:01")
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
[
{
"ip": "192.168.0.100",
"mac": "68:B5:99:CE:E3:01",
"options": [
{
"name": "Bootfile Name",
"optionId": "67",
"policyName": null,
"type": "String",
"userClass": "",
"value": "undionly.kpxe",
"vendorClass": ""
},
{
"name": "DNS Servers",
"optionId": "6",
"policyName": null,
"type": "IPv4Address",
"userClass": "",
"value": "8.8.8.8, 8.8.8.4",
"vendorClass": ""
},
{
"name": "Boot Server Host Name",
"optionId": "66",
"policyName": null,
"type": "String",
"userClass": "",
"value": "192.168.0.150",
"vendorClass": ""
},
{
"name": "Bootfile Name",
"optionId": "67",
"policyName": null,
"type": "String",
"userClass": "gPXE",
"value": "http://95.211.51.8/server/getPxeConfig/serverId/11895/key/bf59bdac764fe8ab62646fce063d8429",
"vendorClass": ""
}
],
"scope": "192.168.0.64"
}
]
GETRetrieve a DHCP lease
To retrieve a DHCP lease resource for a specific MAC address, send a GET request request to /v1/bareMetals/{bareMetalId}/leases/{macaddress}.
The response will be a JSON object containing the following attribute:
| Name | Type | Description |
|---|---|---|
| ip | string | The assigned IP for the DHCP lease |
| mac | string | The MAC address the DHCP lease is assigned to |
| scope | string | The scope of the DHCP lease |
| options | object | An object of DHCP lease options |
The options object is an array of DHCP lease options, each of which contains the following attributes:
| Name | Type | Description |
|---|---|---|
| name | string | Name of the DHCP option |
| optionId | string | DHCP option identifier |
| policyName | string | DHCP option policy name |
| type | string | DHCP option type |
| userClass | string | DHCP option user class |
| value | string | Value used for the DHCP option |
| vendorClass | string | DHCP option vendor class |
DELETEhttps://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01REQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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("DELETE", "/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01", 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/bareMetals/12345/leases/28:B5:99:CE:E3:01")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
No Content
DELETEDelete a DHCP lease
To delete a DHCP lease resource for a specific MAC address, send a DELETE request request to /v1/bareMetals/{bareMetalId}/leases/{macaddress}.
On success the reponse will be a HTTP 204 No Content.
Operating Systems
The Operating System resources gives information about available Operating Systems which can be used when reinstalling a bare metal server. It also provides information on available control panels for each Operating System resource.
GEThttps://api.leaseweb.com/v1/operatingSystemsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/operatingSystems \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems",
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/operatingSystems", 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/operatingSystems")
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
{
"operatingSystems": [
{
"operatingSystem": {
"id": 664,
"name": "CentOS 5 (i386)"
}
},
{
"operatingSystem": {
"id": 665,
"name": "CentOS 5 (x86_64)"
}
},
{
"operatingSystem": {
"id": 867,
"name": "CentOS 6 (i386)"
}
}
]
}
GETList all Operating Systems
To retrieve a list of all of available Operating Systems you can use for installations, send a GET request to /v1/operatingSystems.
The response will be a JSON object with key operatingSystems containing an array of available Operating Systems,
each of which contain the standard Operating System attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier for the Operating Systems resource |
| name | string | The name of the Operating Systems resource |
GEThttps://api.leaseweb.com/v1/operatingSystems/138REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/operatingSystems/138 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138",
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/operatingSystems/138", 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/operatingSystems/138")
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
{
"operatingSystem": {
"id": 123,
"name": "CentOS 6 (x86_64)"
}
}
GETRetrieve an Operating Systems
To retrieve a single Operating Systems resource, send a GET request to /v1/operatingSystems/{operatingSystemId}.
The response will be a JSON object with key operatingSystem containing the standard Operating System attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier for the Operating Systems resource |
| name | string | The name of the Operating Systems resource |
GEThttps://api.leaseweb.com/v1/operatingSystems/138/controlPanelsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/operatingSystems/138/controlPanels \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138/controlPanels",
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/operatingSystems/138/controlPanels", 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/operatingSystems/138/controlPanels")
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
{
"controlPanels": [
{
"controlPanel": {
"id": 100,
"name": "cPanel/WHM 11"
}
},
{
"controlPanel": {
"id": 101,
"name": "Plesk 10.4 (Unlimited domains)"
}
},
{
"controlPanel": {
"id": 102,
"name": "Plesk 10.4 (10 domains Linux)"
}
},
{
"controlPanel": {
"id": 103,
"name": "Plesk 11 (10 Domains Linux)"
}
}
]
}
GETList all Control Panels
To retrieve a list of all of available Control Panels for a specific Operating System, send a GET request to /v1/operatingSystems/{operatingSystemId}/controlPanels.
The response will be a JSON object with key controlPanels containing an array of available Control Panels,
each of which contain the standard Control Panel attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier for the Control Panel resource |
| name | string | The name of the Control Panel resource |
GEThttps://api.leaseweb.com/v1/operatingSystems/138/controlPanels/456REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/operatingSystems/138/controlPanels/456 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138/controlPanels/456",
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/operatingSystems/138/controlPanels/456", 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/operatingSystems/138/controlPanels/456")
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
{
"controlPanel": {
"id": 456,
"name": "cPanel/WHM 11"
}
}
GETRetrieve a Control Panel
To retrieve a single Control Panels resource, send a GET request to /v1/operatingSystems/{operatingSystemId}/controlPanels/{controlPanelId}.
The response will be a JSON object with key controlPanel containing the standard Control Panel attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier for the Control Panel resource |
| name | string | The name of the Control Panel resource |
GEThttps://api.leaseweb.com/v1/operatingSystems/138/partitionSchemaREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/operatingSystems/138/partitionSchema \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138/partitionSchema",
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/operatingSystems/138/partitionSchema", 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/operatingSystems/138/partitionSchema")
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
{
"partitionSchema": {
"limit": 7,
"disks": {
"disk": [
"/dev/sda",
"/dev/hda",
"/dev/cciss/c0d0"
]
},
"suggestion": {
"disk": "/dev/sda",
"bootable": 0,
"hdd": {
"partition": [
{
"index": 0,
"size": "100",
"type": "ext2",
"mountpoint": "/boot"
},
{
"index": 1,
"size": "4096",
"type": "swap",
"mountpoint": ""
},
{
"index": 2,
"size": "2048",
"type": "ext4",
"mountpoint": "/tmp"
},
{
"index": 3,
"size": "*",
"type": "ext4",
"mountpoint": "/"
}
]
}
},
"filesystemTypes": {
"type": [
"ext2",
"ext3",
"ext4",
"xfs",
"swap"
]
}
}
}
GETRetrieve a Partition Schema
To retrieve a Partion Schema resource, send a GET request to /v1/operatingSystems/{operatingSystemId}/partitionSchema?serverPackId={bareMetalId}. The
The resource will provide information of available disks, filesystem types and a suggestion for possible partition Schema to be used when istallation a server.
The response will be a JSON object with key partionSchema containing the standard Partition Schema attributes:
| Name | Type | Description |
|---|---|---|
| limit | integer | ** |
| name | string | The name of the Control Panel resource |
Rescue Images
The Rescue Image resources are bootable images that you can use to reboot your server with. These are small bootable images which will set a random password when booting which gives you control over a server which did not react normal anymore.
GEThttps://api.leaseweb.com/v1/rescueImagesREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/rescueImages \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/rescueImages",
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/rescueImages", 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/rescueImages")
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
{
"rescueImages": [
{
"rescueImage": {
"id": 121,
"name": "FreeBSD Rescue 2.1 (amd64)"
}
},
{
"rescueImage": {
"id": 122,
"name": "FreeBSD Rescue 2.1 (x86)"
}
},
{
"rescueImage": {
"id": 137,
"name": "Rescue 2.1 (amd64)"
}
},
{
"rescueImage": {
"id": 138,
"name": "Rescue 2.1 (x86)"
}
}
]
}
GETList your Recue Images
To retrieve a list of all of available rescue Images, send a GET request to /v1/rescueImages.
The response will be a JSON object with key rescueImages containing an array of available rescueImages,
each of which contain the standard rescue Image attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier for the rescue Image resource |
| name | string | The name of the rescue Image resource |
Private Racks
The Private Racks resources are private racks you have at LeaseWeb. This resource gives you information about private racks and control over them.
GEThttps://api.leaseweb.com/v1/privateRacksREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks",
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/privateRacks", 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/privateRacks")
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
{
"privateRacks": [
{
"privateRack": {
"privateRackId": "24123"
}
},
{
"privateRack": {
"privateRackId": "28374"
}
}
]
}
GETList your Private Racks
To retrieve a list of all of your private racks, send a GET request to /v1/privateRacks.
The response will be a JSON object with key privateRacks containing an array of your private racks, each of which contain the following attributes:
| Name | Type | Description |
|---|---|---|
| privateRackId | string | The identifier of the private rack resource |
GEThttps://api.leaseweb.com/v1/privateRacks/12345REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks/12345 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345",
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/privateRacks/12345", 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/privateRacks/12345")
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
{
"privateRack" : {
"serviceLevelAgreement" : {
"sla": "Basic - 24x7x24"
},
"serverHostingPack" : {
"privateRackId" : "123456",
"startDate": "Feb 1, 2015",
"reference" : null,
"privateRackName" : "LSW - TEST"
},
"privateRackId" : "123456",
"location" : {
"cabinet" : "1",
"site" : "AMS-01",
"suite" : "1.11"
},
"privateRackName" : "LSW - TEST"
}
}
GETRetrieve a Private Rack resource
To get information about a specific private rack, send a GET request to /v1/privateRacks/{privateRackId}.
The response will be a JSON object contain the following attributes:
| Name | Type | Description |
|---|---|---|
| privateRackId | integer | The identifier of the private rack resource |
| privateRackName | string | The name of the private rack |
| location | object | An object with location information |
| serverHostingPack | object | An object with pack information |
| serviceLevelAgreement | object | An object with SLA information |
The location object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| site | string | The site where the private rack is located |
| cabinet | string | The cabinet the private rack is located in |
| suite | string | The suite number of the private rack |
The serverHostingPack object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| reference | string | Reference set for the private rack |
| privateRackId | integer | The identifier of the private rack resource |
| privateRackName | string | The name of the private rack |
| startDate | date | Bare metal contract start date |
| endDate | date | Bare metal contract end date |
The serviceLevelAgreement object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| sla | string | Human readable name of the SLA agreement |
GEThttps://api.leaseweb.com/v1/privateRacks/12345/ipsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks/12345/ips \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/ips",
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/privateRacks/12345/ips", 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/privateRacks/12345/ips")
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
{
"ips": [
{
"ip": {
"privateRackId" : "1234",
"ip": "4.3.2.1",
"billingInformation": {
"startDate": "Feb 1, 2014",
"endDate": null,
"price": "0.00"
},
"nullRouted": false
}
}
]
}
GETPrivate Rack IPs
To retrieve a list of all of your private rack IPs, send a GET request to /v1/privateRacks/{privateRackId}/ips.
The response will be a JSON object with key ips containing an array of your IPs, each of which contain the standard IP attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | The IP |
| privateRackId | integer | Identifier of the private rack |
| billingInformation | object | Object containing information about billing |
| nullRouted | boolean | Boolean to indicate if the IP is null-routed |
The billingInformation object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| price | string | Monthly price for the IP resource |
| startDate | string | The start date for the IP resource |
| endDate | string | The end date of the IP resource |
GEThttps://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111",
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/privateRacks/12345/ips/85.17.96.111", 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/privateRacks/12345/ips/85.17.96.111")
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
{
"ip": {
"privateRackId": "1234",
"ip": "4.3.2.1",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"billingInformation": {
"startDate": "Feb 1, 2014",
"endDate": null,
"price": "0.00"
}
}
}
GETRetrieve an Private Rack IP
To retrieve a single IP resource for a private rack, send a GET request to /v1/privateRacks/1234/ips/{ipAddress}.
The response will be a JSON object with key ip containing the standard IP attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | The IP |
| reverseLookup | string | The reverse lookup set for the IP |
| nullRouted | boolean | Boolean to indicate if the IP is null-routed |
| privateRackId | string | Identifier of the private rack associated to the IP |
| billingInformation | object | Object containing information about billing |
The billingInformation object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| price | string | Monthly price for the IP resource |
| startDate | string | The start date for the IP resource |
| endDate | string | The end date of the IP resource |
PUThttps://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data reverseLookup=my-reverse.hostname.com \
--data nullRouted=0
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "reverseLookup=my-reverse.hostname.com&nullRouted=0",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "reverseLookup=my-reverse.hostname.com&nullRouted=0"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("PUT", "/v1/privateRacks/12345/ips/85.17.96.111", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "reverseLookup=my-reverse.hostname.com&nullRouted=0"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ip": {
"privateRackId": "1234",
"ip": "4.3.2.1",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"billingInformation": {
"startDate": "Feb 1, 2014",
"endDate": null,
"price": "0.00"
}
}
}
PUTUpdate an Private Rack IP
To update the reverse lookup or to nullroute an IP for a private rack, send a PUT request to /v1/privateRacks/1234/ips/{ipAddress}.
The request should contain one of the following form parameters:
| Name | Type | Description |
|---|---|---|
| reverseLookup | string | The reverse lookup for the IP resource |
| nullRouted | boolean | A boolean indicating whether the IP should be nullrouted (0=false, 1=true) |
GEThttps://api.leaseweb.com/v1/privateRacks/12345/networkUsageREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks/12345/networkUsage \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/networkUsage",
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/privateRacks/12345/networkUsage", 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/privateRacks/12345/networkUsage")
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
{
"bandwidth": {
"measurement": {
"node": {
"in": "-",
"out": "-",
"total": "44.85 Mbps"
},
"total": "44.85 Mbps",
"average": "44.85 Mbps"
},
"overusage": "0 bps",
"privateRackId": 1234,
"privateRackName": "My private rack",
"interval": {
"from": "11-06-2014",
"to": "10-07-2014"
},
"monthlyThreshold": "0 Mbps"
},
"dataTraffic": {
"measurement": {
"node": {
"in": "10.3 GB",
"out": "25.4 GB",
"total": "35.7 GB"
},
"total": "35.7 GB"
},
"overusage": "0 B",
"privateRackId": 1234,
"privateRackName": "My private rack",
"interval": {
"from": "01-01-2014",
"to": "10-06-2014"
},
"monthlyThreshold": "0 GB"
}
}
GETPrivate Rack Network Usage
To retrieve the network usage of your private rack, send
a GET request to /v1/privateRacks/{privateRackId}/networkUsage.
You can use the following querystring paramaters:
| Name | Type | Description |
|---|---|---|
| dateFrom | string | Start date of the usage calculation, format: DD-MM-YYYY |
| dateTo | string | End date of the usage calculation, format: DD-MM-YYYY |
The response will be a JSON object containing the following attributes:
| Name | Type | Description |
|---|---|---|
| bandwidth | object | Object with bandwidth information |
| datatraffic | obect | Object with datatraffic information |
Both the bandwidth object and the datatraffic object contain the following attributes:
| Name | Type | Description |
|---|---|---|
| measurement | object | Object containing measurement information |
| overusage | string | Amount of overusage including the unit, for example: "1.2 Mbps" |
| privateRackId | integer | Private rack identifier |
| privateRackName | string | Private rack name |
| interval | object | Object containg the measurement date range information |
| monthlyThreshold | string |
The measurement object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| node | object | Small object with attributes "in", "out" and "total" representing the usage per measured network port |
| total | string | Totale usage over the given interval |
| average | string | Average bandwidth usage over the given interval. Only for bandwidth measurements. |
The interval object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| from | string | Start date of the measurement |
| to | string | End date of the measurement |
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| dateFrom | Start date for the network usage calculation | |
| dateTo | End date for the network usage calculation |
GEThttps://api.leaseweb.com/v1/privateRacks/12345/networkUsage/bandwidthREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks/12345/networkUsage/bandwidth \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/networkUsage/bandwidth",
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/privateRacks/12345/networkUsage/bandwidth", 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/privateRacks/12345/networkUsage/bandwidth")
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
GETPrivate Rack Bandwidth
To retrieve the bandwidth usage of your private rack, send
a GET request to /v1/privateRacks/{privateRackId}/networkUsage/bandwidth.
You can use the following querystring paramaters:
| Name | Type | Description |
|---|---|---|
| dateFrom | string | Start date of the usage calculation, format: DD-MM-YYYY |
| dateTo | string | End date of the usage calculation, format: DD-MM-YYYY |
You can also send an Accept header with values application/json for JSON response or image/png to retrieve
the bandwidth as an image.
The response will be a JSON object with key bandwidth containing the following attributes:
| Name | Type | Description |
|---|---|---|
| measurement | object | Object containing measurement information |
| overusage | string | Amount of overusage including the unit, for example: "1.2 Mbps" |
| privateRackId | integer | Private rack identifier |
| privateRackName | string | Private rack name |
| interval | object | Object containg the measurement date range information |
| monthlyThreshold | string |
The measurement object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| node | object | Small object with attributes "in", "out" and "total" representing the usage per measured network port |
| total | string | Totale usage over the given interval |
| average | string | Average bandwidth usage over the given interval |
The interval object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| from | string | Start date of the measurement |
| to | string | End date of the measurement |
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| dateFrom | Start date for the network usage calculation | |
| dateTo | End date for the network usage calculation |
GEThttps://api.leaseweb.com/v1/privateRacks/12345/networkUsage/datatrafficREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateRacks/12345/networkUsage/datatraffic \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/networkUsage/datatraffic",
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/privateRacks/12345/networkUsage/datatraffic", 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/privateRacks/12345/networkUsage/datatraffic")
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
GETPrivate Rack Datatraffic
To retrieve the datatraffc used by your private rack, send
a GET request to /v1/privateRacks/{privateRackId}/networkUsage/datatraffic.
You can use the following querystring paramaters:
| Name | Type | Description |
|---|---|---|
| dateFrom | string | Start date of the usage calculation, format: DD-MM-YYYY |
| dateTo | string | End date of the usage calculation, format: DD-MM-YYYY |
You can also send an Accept header with values application/json for JSON response or image/png to retrieve
the bandwidth as an image.
The response will be a JSON object with key bandwidth containing the following attributes:
| Name | Type | Description |
|---|---|---|
| measurement | object | Object containing measurement information |
| overusage | string | Amount of overusage including the unit, for example: "1.2 Mbps" |
| privateRackId | integer | Private rack identifier |
| privateRackName | string | Private rack name |
| interval | object | Object containg the measurement date range information |
| monthlyThreshold | string |
The measurement object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| node | object | Small object with attributes "in", "out" and "total" representing the usage per measured network port |
| total | string | Totale usage over the given interval |
The interval object contains the following attrbutes:
| Name | Type | Description |
|---|---|---|
| from | string | Start date of the measurement |
| to | string | End date of the measurement |
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| dateFrom | Start date for the network usage calculation | |
| dateTo | End date for the network usage calculation |
Private Networks
The Private Networks resources gives you control over private networks between your bare metal servers. Use this resource to create new private networks and add or remove bare metal servers from the private network.
GEThttps://api.leaseweb.com/v1/privateNetworksREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateNetworks \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks",
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/privateNetworks", 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/privateNetworks")
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
{
"_metadata": {
"totalCount": 1,
"limit": 10,
"offset": 0
},
"privateNetworks": [
{
"serverCount": 0,
"id": 811,
"name": "",
"customerNumber": "0123456789",
"createdAt": "2015-07-16T13:06:45+0200",
"updatedAt": "2015-07-16T13:06:45+0200"
}
]
}
GETList your Private Networks
To retrieve a list of all your private network, send a GET request to /v1/privateNetworks.
The response will be a JSON object with key privateNetworks containing an array of your private network, each of which contain the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the private network |
| name | string | The name of the private network |
| serverCount | integer | Number of servers connected to this private network |
| createdAt | date | Date timestamp when the resource was created |
| updatedAt | date | Date timestamp when the resource was last updated |
| customerNumner | string | Your customer number |
POSThttps://api.leaseweb.com/v1/privateNetworksREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/privateNetworks \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks",
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/privateNetworks", 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/privateNetworks")
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
{
"id": 1,
"message": "Your Private Network is successfully created."
}
POSTCreate a Private Network
To create a new Private Network resources, send a POST request to /v1/privateNetworks.
The response will be a JSON object containing the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the newly created private network |
| message | string | A status message |
GEThttps://api.leaseweb.com/v1/privateNetworks/1REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/privateNetworks/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/privateNetworks/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/privateNetworks/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/privateNetworks/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
[
{
"id": 1,
"name": "my-private-network",
"bareMetals":
[
{
"id": "12345",
"dataCenter": "SFO-12",
"CIDR": "10.29.0.0/27",
"broadcast": "10.29.0.31",
"gateway": "10.29.0.30",
"netmask": "10.29.0.0",
"status": "CONFIGURED"
},
{
"id": "72649",
"dataCenter": "SFO-12",
"CIDR": "10.29.0.0/27",
"broadcast": "10.29.0.31",
"gateway": "10.29.0.30",
"netmask": "10.29.0.0",
"status": "REMOVING"
}
]
}
]
GETRetrieve a Private Network
To get information about a specific private network, send a GET request to /v1/privateNetworks/{id}.
The response will be a JSON object containing the standard private network attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the private network |
| name | string | The name of the private network |
| bareMetals | object | Array of bareMetals servers connected to this private network |
The bareMetals object contains an array of bare metal servers, each of which contain the following attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier of the bare metal server |
| dataCenter | string | The location of the bare metal server |
| CIDR | string | The private network ip address in CIDR notation assigned to the bare metal server |
| broadcast | string | |
| gateway | string | |
| netmask | string | |
| status | string | |
| portSpeed | string |
Every bare metal server in your private network contains a ‘status’ key explaining the current state of your server in your private network.
Possbile state values are:
CONFIGURING: Your server is currently being added to the private network (can take ~1 minute)
CONFIGURED: Your server is part of the private network.
REMOVING: Your server is currently being removed from the private network (can take ~1 minute)
To retrieve a information s you can use for installations, send a GET request to /v1/operatingSystems.
The response will be a JSON object with key operatingSystems containing an array of available Operating Systems,
each of which contain the standard Operating System attributes:
| Name | Type | Description |
|---|---|---|
| id | integer | The identifier for the Operating Systems resource |
| name | string | The name of the Operating Systems resource |
DELETEhttps://api.leaseweb.com/v1/privateNetworks/1REQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/v1/privateNetworks/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/privateNetworks/1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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("DELETE", "/v1/privateNetworks/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/privateNetworks/1")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"message": "Your Private Network has been successfully deleted.",
}
DELETEDelete a Private Network
To remove a Private Network resource, send a DELETE request to /v1/privateNetworks/{privateNetworkId}.
The response will be a JSON object containing a message attribute:
| Name | Type | Description |
|---|---|---|
| message | string | A human readable message indicating your private network has been deleted |
POSThttps://api.leaseweb.com/v1/privateNetworks/1/bareMetalsREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/v1/privateNetworks/1/bareMetals \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data bareMetalId=12345
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks/1/bareMetals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "bareMetalId=12345",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$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")
payload = "bareMetalId=12345"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("POST", "/v1/privateNetworks/1/bareMetals", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/privateNetworks/1/bareMetals")
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'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "bareMetalId=12345"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
No Content
POSTAdd a bare metal server
To add a Bare Metal server to a Private Network resource, send a POST request to /v1/privateNetworks/{privateNetworkId}/bareMetals.
The request should contain the following form parameters:
| Name | Type | Description |
|---|---|---|
| bareMetalId | integer | The identifier of the Bare Metal server you want to add to the Private Network resource |
On success the response will be a 204 No Content.
DELETEhttps://api.leaseweb.com/v1/privateNetworks/1/bareMetals/12345REQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/v1/privateNetworks/1/bareMetals/12345 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks/1/bareMetals/12345",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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("DELETE", "/v1/privateNetworks/1/bareMetals/12345", 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/privateNetworks/1/bareMetals/12345")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
No Content
DELETERemove a bare metal server
To remove a Bare Metal server form the Private Network resource, send a DELETE request to /v1/privateNetworks/{privateNetworkId}/bareMetals/{bareMetalId}.
On success the Bare Metal server will be removed from the Private Network resource and the response status will be a 204 with no body returned.