Bare Metals API v2
Dedicated Servers API
This API can be used to manage your dedicated servers
GEThttps://api.leaseweb.com/bareMetals/v2/serversREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers",
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", "/bareMetals/v2/servers", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers")
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": 132,
"limit": 2,
"offset": 80
},
"servers": [
{
"id": "12345",
"location": {
"site": "AMS-01",
"suite": "99",
"rack": "A83",
"unit": "16-17"
},
"featureAvailability": {
"automation": true,
"privateNetwork": true,
"powerCycle": true,
"ipmiReboot": false,
"remoteManagement": false
},
"networkInterfaces": {
"internal": {
"gateway": null,
"ip": null,
"mac": "AA:BB:CC:DD:EE:FF",
"ports": [
{
"name": "EVO-AABB-01",
"port": "30"
}
]
},
"public": {
"gateway": "95.211.162.62",
"ip": "95.211.162.0",
"mac": "AA:AC:CC:88:EE:E4",
"ports": []
},
"remoteManagement": {
"gateway": "10.22.192.126",
"ip": "10.22.192.1",
"mac": "AA:AC:CC:88:EE:E4",
"ports": []
}
},
"powerPorts": [
{
"name": "EVO-JV12-APC02",
"port": "10"
}
],
"contract": {
"id": "674382",
"reference": "database.server",
"internalReference": "AAA002",
"customerId": "32923828192",
"salesOrgId": "2300",
"deliveryStatus": "ACTIVE"
}
},
{
"id": "47854",
"location": {
"site": "AMS-01",
"suite": "A6",
"rack": "13",
"unit": "18"
},
"featureAvailability": {
"automation": false,
"privateNetwork": false,
"powerCycle": false,
"remoteManagement": false
},
"networkInterfaces": {
"internal": null,
"public": null,
"remoteManagement": null
},
"contract": {
"id": "929282",
"reference": "web.server",
"internalReference": "AAA003",
"customerId": "32923828192",
"salesOrgId": "2300",
"deliveryStatus": "ACTIVE"
}
}
]
}
GETList all dedicated servers
This API returns a paginated list of all dedicated servers.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
| ip | 10.29.23.123 | Filter the list of servers by ip address |
| macAddress | AA:BB:CC:DD:EE:FF | Filter the list of servers by mac address |
| deliveryStatus | pending | Filter the list of servers by their delivery status (Allowed values: pending,active) |
| site | AMS-01 | Filter the list of servers by data center (location) |
| reference | database | Filter the list of servers by reference |
| privateRackId | 2892910 | Filter the list of servers by private rack id |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| servers | array | An array of servers |
| id | string | Id of the server |
| location | object | Location of the server |
| networkInterfaces | object | Network interface information grouped by type |
| featureAvailability | object | List of features that are available for this server |
| contract | object | Contract information |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/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", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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
{
"id": "12345",
"location": {
"site": "AMS-01",
"suite": "A6",
"rack": "13",
"unit": "16-17"
},
"specs": {
"chassis": "Dell R210 II",
"hardwareRaidCapable": true,
"cpu": {
"type": "Intel Xeon E3-1220",
"quantity": 4
},
"ram": {
"size": 32,
"unit": "GB"
},
"hdd": [
{
"size": 500,
"unit": "GB",
"amount": 10,
"type": "SATA"
}
]
},
"serialNumber": "JDK18291JK",
"networkInterfaces": {
"public": {
"mac": "AA:BB:CC:DD:EE:FF",
"ip": "123.123.123.123/27",
"gateway": "123.123.123.126",
"ports": [
{
"name": "EVO-JV12-1",
"port": "33"
}
]
},
"internal": {
"mac": "AA:BB:CC:DD:EE:FF",
"ip": "123.123.123.123/27",
"gateway": "123.123.123.126",
"ports": []
},
"remoteManagement": null
},
"powerPorts": [
{
"name": "EVO-JV12-APC02",
"port": "10"
}
],
"featureAvailability": {
"automation": true,
"privateNetwork": true,
"powerCycle": true,
"ipmiReboot": false,
"remoteManagement": false
},
"contract": {
"id": "674382",
"reference": "database.server",
"internalReference": "AAA002",
"customerId": "32923828192",
"salesOrgId": "2300",
"deliveryStatus": "ACTIVE",
"startsAt": "2014-01-01T01:00:00+0100",
"endsAt": "2017-10-01T01:00:00+0100",
"sla": "BRONZE",
"billingCycle": 12,
"billingFrequency": "MONTH",
"pricePerFrequency": 49.00,
"currency": "EUR",
"networkTraffic": {
"type": "95|FLATFEE|DATATRAFFIC",
"trafficType": "PREMIUM|VOLUME",
"datatrafficLimit": 100,
"datatrafficUnit": "TB|Mbps"
},
"softwareLicenses": [
{
"name": "WINDOWS_2012_R2_SERVER",
"price": 12.12,
"currency": "EUR"
}
]
}
}
GETGet Dedicated Server
Retrieve information about a single server.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| id | string | Id of the server |
| location | object | Location of the server |
| networkInterfaces | object | Network interface information grouped by type |
| featureAvailability | object | List of features that are available for this server |
| specs | object | Hardware information of server |
| serialNumber | string | Serial number of server |
| powerPorts | array | List of ports that can be used to manage power of the server |
| contract | object | Contract information |
PUThttps://api.leaseweb.com/bareMetals/v2/servers/12345REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"reference": "database-server"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/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\": \"database-server\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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\": \"database-server\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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"] = 'application/json'
request.body = "{ \"reference\": \"database-server\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
If the reference was succesfully set a 204 No Content is returned
PUTUpdate Reference
This API call allows you to update the reference for a server. A reference can
be used to uniquely identify a server with a name, such as database-server.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| reference | string | true | The reference for this server |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareInfoREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareInfo \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareInfo",
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", "/bareMetals/v2/servers/12345/hardwareInfo", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareInfo")
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": "2378237",
"serverId": "62264",
"scannedAt": "2017-09-27 14:21:01",
"parserVersion": "3.6",
"result": {
"chassis": {
"description": "Rack Mount Chassis",
"product": "ProLiant DL120 G7 (647339-B21)",
"vendor": "HP",
"serial": "CZ33109CHV",
"motherboard": {
"product": "",
"vendor": "",
"serial": ""
},
"firmware": {
"description": "BIOS",
"vendor": "HP",
"version": "J01",
"date": "07/01/2013"
}
},
"cpu": [
{
"description": "Intel(R) Xeon(R) CPU E31230",
"vendor": "Intel Corp.",
"serial_number": "",
"hz": "2792640000",
"settings": {
"cores": "4",
"enabledcores": "4",
"threads": "8"
},
"slot": "Proc 1",
"capabilities": {
"cpufreq": "CPU Frequency scaling",
"ht": "HyperThreading",
"vmx": false,
"x86-64": "64bits extensions (x86-64)"
}
}
],
"memory": [
{
"id": "memory/bank:0",
"description": "DIMM DDR3 Synchronous 1333 MHz (0.8 ns)",
"size_bytes": "4294967296",
"clock_hz": "1333000000",
"serial_number": "8369AF58"
},
{
"id": "memory/bank:1",
"description": "DIMM DDR3 Synchronous 1333 MHz (0.8 ns)",
"size_bytes": "4294967296",
"clock_hz": "1333000000",
"serial_number": "8369B174"
}
],
"disks": [
{
"id": "disk:0",
"description": "ATA Disk",
"product": "Hitachi HDS72302",
"vendor": "Hitachi",
"serial_number": "MS77215W07S6SA",
"size": "2000398934016",
"smartctl": {
"smart_support": {
"available": true,
"enabled": true
},
"smartctl_version": "6.2",
"execution_status": "0",
"device_model": "Hitachi HDS723020BLE640",
"serial_number": "MS77215W07S6SA",
"overall_health": "PASSED",
"attributes": {
"Reallocated_Sector_Ct": {
"id": " 5",
"flag": "0x0033",
"value": "100",
"worst": "100",
"thresh": "005",
"type": "Pre-fail",
"updated": "Always",
"when_failed": "-",
"raw_value": "0"
},
"Power_On_Hours": {
"id": " 9",
"flag": "0x0012",
"value": "095",
"worst": "095",
"thresh": "000",
"type": "Old_age",
"updated": "Always",
"when_failed": "-",
"raw_value": "39832"
}
},
"ata_version": "ATA8-ACS T13/1699-D revision 4",
"sata_version": "SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)",
"sector_size": "512 bytes logical, 4096 bytes physical",
"smart_error_log": "No Errors Logged",
"firmware_version": "MX4OAAB0",
"user_capacity": "2,000,398,934,016 bytes [2.00 TB]",
"rpm": "7200 rpm",
"is_sas": false
}
}
],
"network": [
{
"logical_name": "eth0",
"mac_address": "28:92:4a:33:48:e6",
"vendor": "Intel Corporation",
"product": "82574L Gigabit Network Connection",
"settings": {
"autonegotiation": "on",
"broadcast": "yes",
"driver": "e1000e",
"driverversion": "3.2.6-k",
"duplex": "full",
"firmware": "2.1-2",
"ip": "212.32.230.67",
"latency": "0",
"link": "yes",
"multicast": "yes",
"port": "twisted pair",
"speed": "1Gbit/s"
},
"capabilities": {
"pm": "Power Management",
"msi": "Message Signalled Interrupts",
"pciexpress": "PCI Express",
"msix": "MSI-X",
"bus_master": "bus mastering",
"cap_list": "PCI capabilities listing",
"ethernet": "",
"physical": "Physical interface",
"tp": "twisted pair",
"link_speeds": {
"10bt": "10Mbit/s",
"10bt-fd": "10Mbit/s (full duplex)",
"100bt": "100Mbit/s",
"100bt-fd": "100Mbit/s (full duplex)",
"1000bt-fd": "1Gbit/s (full duplex)"
},
"autonegotiation": "Auto-negotiation"
},
"lldp": {
"chassis": {
"mac_address": "4c:16:fc:3a:84:c0",
"name": "EVO-NS19-1",
"description": "Juniper Networks, Inc. ex3300-48t Ethernet Switch, kernel JUNOS 15.1R5.5, Build date: 2016-11-25 16:02:59 UTC Copyright (c) 1996-2016 Juniper Networks, Inc."
},
"port": {
"description": "ge-0/0/2.0",
"auto_negotiation": {
"enabled": "yes",
"supported": "yes"
}
},
"vlan": {
"id": "0",
"label": "VLAN",
"name": "default"
}
}
}
],
"ipmi": {
"ipsource": "DHCP Address",
"macaddress": "28:92:4a:33:48:e8",
"ipaddress": "10.19.79.67",
"subnetmask": "255.255.255.192",
"defgateway": "10.19.79.126",
"vendor": "Hewlett-Packard",
"firmware": "1.88"
}
}
}
GETHardware Information
Display server hardware information. This information is generated when running a hardware scan for your server. A hardware scan collects hardware information about your system.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| id | string | Id of this hardware scan result |
| serverId | string | The server id |
| scannedAt | datetime | Timestamp of hardware scan |
| parserVersion | integer | Version of the parser used for this hardware info |
| result | object | Hardware info e.g. chassis, cpu, memory and etc. |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/expireActiveJobREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/expireActiveJob \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/expireActiveJob",
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", "/bareMetals/v2/servers/12345/expireActiveJob", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/expireActiveJob")
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
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 0,
"inprogress": 0,
"finished": 0,
"failed": 0,
"expired": 1,
"canceled": 0,
"percentage": 0
},
"isRunning": false,
"status": "EXPIRED",
"uuid": "fe54dd20-a815-47da-bcb4-5550a160dbbe",
"type": "install",
"serverId": "99944",
"node": "80:18:44:E0:AF:C4!JGNTQ92",
"payload": {
"powerCycle": true,
"jobType": "install",
"configurable": true,
"device": "/my/ubuntu/device",
"os": {
"type": "linux",
"name": "Ubuntu 14.04 LTS (Trusty Tahr) (x86)",
"family": "ubuntu",
"version": "14.04",
"architecture": "32bit"
},
"partitions": [
{
"size": 4096,
"filesystem": "swap"
}
],
"raidLevel": null,
"numberOfDisks": null,
"operatingSystemId": "UBUNTU_1404_32X86",
"serverId": "99944",
"pop": "AMS-01",
"tftpBaseUrl": "",
"timezone": "UTC",
"x": 1
},
"createdAt": "2018-01-09T08:50:45+0000",
"updatedAt": "2018-01-09T08:51:54+0000",
"tasks": [
{
"uuid": "0286423e-06ac-49bf-ace5-35af97bde4b1",
"status": "EXPIRED",
"description": "dummy",
"onError": "break",
"errorMessage": "The job was expired by the api consumer",
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T08:50:45+00:00",
"PENDING": "2018-01-09T08:50:45+00:00",
"EXPIRED": "2018-01-09T08:51:54+00:00"
}
}
],
"flow": "#stop"
}
POSTExpire active job
Expire the current active job for the server. Expiring an active job will not have any influence on the current state of the server and is merely an administrative action.
Often you want to cancel the job, resulting in a server reboot. In that case
use the /cancelActiveJob API call instead.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/cancelActiveJobREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/cancelActiveJob \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/cancelActiveJob",
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", "/bareMetals/v2/servers/12345/cancelActiveJob", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/cancelActiveJob")
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
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 0,
"inprogress": 0,
"finished": 0,
"failed": 0,
"expired": 0,
"canceled": 1,
"percentage": 0
},
"isRunning": false,
"status": "CANCELED",
"uuid": "c77d8a6b-d255-4744-8b95-8bf4af6f8b48",
"type": "install",
"serverId": "99944",
"node": "80:18:44:E0:AF:C4!JGNTQ92",
"payload": {
"powerCycle": true,
"jobType": "install",
"configurable": true,
"device": "/my/ubuntu/device",
"os": {
"type": "linux",
"name": "Ubuntu 14.04 LTS (Trusty Tahr) (x86)",
"family": "ubuntu",
"version": "14.04",
"architecture": "32bit"
},
"partitions": [
{
"size": 4096,
"filesystem": "swap"
}
],
"raidLevel": null,
"numberOfDisks": null,
"operatingSystemId": "UBUNTU_1404_32X86",
"serverId": "99944",
"pop": "AMS-01",
"tftpBaseUrl": "",
"timezone": "UTC",
"x": 1
},
"createdAt": "2018-01-09T08:54:06+0000",
"updatedAt": "2018-01-09T08:54:15+0000",
"tasks": [
{
"uuid": "085ce145-39bd-4cb3-8e2b-53f17a97a463",
"status": "CANCELED",
"description": "dummy",
"onError": "break",
"errorMessage": "The job was canceled by the api consumer",
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T08:54:06+00:00",
"PENDING": "2018-01-09T08:54:06+00:00",
"CANCELED": "2018-01-09T08:54:15+00:00"
}
}
],
"flow": "#stop"
}
POSTCancel active job
Cancel the current active job for the server. Canceling an active job will
trigger the onfail flow of the current job often resulting in a server
reboot. If you do not want the server state to change expire the active job
instead.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/installREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/install \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"operatingSystemId": "UBUNTU_1604_64AMD",
"controlPanelId": "PLESK_12",
"sshKeys": "ssh-rsa AAAAB3NzaC1y... user@domain.com",
"hostname": "ubuntu16.local",
"device": "/dev/sda",
"partitions": [
{
"mountpoint": "/boot",
"bootable": true,
"primary": true,
"size": 512,
"filesystem": "ext2"
},
{
"size": 4096,
"filesystem": "swap"
},
{
"mountpoint": "/tmp",
"size": 2048,
"filesystem": "ext4"
},
{
"mountpoint": "/",
"primary": true,
"size": "*",
"filesystem": "ext4"
}
]
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/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 => "{ \"operatingSystemId\": \"UBUNTU_1604_64AMD\", \"controlPanelId\": \"PLESK_12\", \"sshKeys\": \"ssh-rsa AAAAB3NzaC1y... user@domain.com\", \"hostname\": \"ubuntu16.local\", \"device\": \"/dev/sda\", \"partitions\": [ { \"mountpoint\": \"/boot\", \"bootable\": true, \"primary\": true, \"size\": 512, \"filesystem\": \"ext2\" }, { \"size\": 4096, \"filesystem\": \"swap\" }, { \"mountpoint\": \"/tmp\", \"size\": 2048, \"filesystem\": \"ext4\" }, { \"mountpoint\": \"/\", \"primary\": true, \"size\": \"*\", \"filesystem\": \"ext4\" } ]}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"operatingSystemId\": \"UBUNTU_1604_64AMD\", \"controlPanelId\": \"PLESK_12\", \"sshKeys\": \"ssh-rsa AAAAB3NzaC1y... user@domain.com\", \"hostname\": \"ubuntu16.local\", \"device\": \"/dev/sda\", \"partitions\": [ { \"mountpoint\": \"/boot\", \"bootable\": true, \"primary\": true, \"size\": 512, \"filesystem\": \"ext2\" }, { \"size\": 4096, \"filesystem\": \"swap\" }, { \"mountpoint\": \"/tmp\", \"size\": 2048, \"filesystem\": \"ext4\" }, { \"mountpoint\": \"/\", \"primary\": true, \"size\": \"*\", \"filesystem\": \"ext4\" } ]}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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"] = 'application/json'
request.body = "{ \"operatingSystemId\": \"UBUNTU_1604_64AMD\", \"controlPanelId\": \"PLESK_12\", \"sshKeys\": \"ssh-rsa AAAAB3NzaC1y... user@domain.com\", \"hostname\": \"ubuntu16.local\", \"device\": \"/dev/sda\", \"partitions\": [ { \"mountpoint\": \"/boot\", \"bootable\": true, \"primary\": true, \"size\": 512, \"filesystem\": \"ext2\" }, { \"size\": 4096, \"filesystem\": \"swap\" }, { \"mountpoint\": \"/tmp\", \"size\": 2048, \"filesystem\": \"ext4\" }, { \"mountpoint\": \"/\", \"primary\": true, \"size\": \"*\", \"filesystem\": \"ext4\" } ]}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"serverId": "12345",
"createdAt": "2018-03-06T21:55:32+0000",
"flow": "tasks",
"isRunning": true,
"node": "AA:BB:CC:DD:EE:FF!DKFJKD8989",
"payload": {
"configurable": true,
"device": "/dev/sda",
"isUnassignedServer": false,
"jobType": "install",
"numberOfDisks": null,
"operatingSystemId": "UBUNTU_16_04_64BIT",
"os": {
"architecture": "64bit",
"family": "ubuntu",
"name": "Ubuntu 16.04 LTS (Xenial Xerus) (amd64)",
"type": "linux",
"version": "16.04"
},
"partitions": [
{
"bootable": true,
"filesystem": "ext2",
"mountpoint": "/boot",
"primary": true,
"size": 500
},
{
"filesystem": "swap",
"size": 4096
},
{
"filesystem": "ext4",
"mountpoint": "/tmp",
"size": 4096
},
{
"filesystem": "ext4",
"mountpoint": "/",
"primary": true,
"size": "*"
}
],
"pop": "AMS-01",
"powerCycle": true,
"raidLevel": null,
"serverId": "12345",
"tftpBaseUrl": "10.11.20.2",
"timezone": "UTC"
},
"progress": {
"canceled": 0,
"expired": 0,
"failed": 0,
"finished": 0,
"inprogress": 0,
"pending": 1,
"percentage": 0,
"total": 26,
"waiting": 25
},
"status": "ACTIVE",
"tasks": [
{
"uuid": "c1a56a5a-ae38-4b12-acb6-0cba9ceb1016",
"status": "PENDING",
"description": "dummy",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T09:18:06+00:00",
"PENDING": "2018-01-09T09:18:06+00:00"
}
}
],
"type": "install",
"updatedAt": "2018-03-06T21:55:32+0000",
"uuid": "bcf2bedf-8450-4b22-86a8-f30aeb3a38f9"
}
POSTLaunch installation
To (re)install your server with an Operating System and optional Control Panel use this API.
To retrieve a list of available operating systems use the
/v2/operatingSystems endpoint.
To retrieve a list of available control panels use the /v2/controlPanels
endpoint.
The default device / partitions to be used are operating system depended and
can be retrieved via the /v2/operatingSystems/{operatingSystemId} endpoint.
On success, the response will be a 202 Accepted containing the scheduled job
definition.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| operatingSystemId | string | true | Operating system identifier |
| password | string | false | Server root password. If not provided, it would be automatically generated |
| sshKeys | string | false | List of public sshKeys to be setup in your installation, separated by new lines |
| controlPanelId | string | false | Control panel identifier |
| hostname | string | false | Hostname to be used in your installation |
| timezone | string | false | Timezone represented as Geographical_Area/City |
| postInstallScript | string | false | Base64 Encoded string containing a valid bash script to be run right after the installation |
| device | string | false | Block device in which the partitions would be installed |
| partitions | array | false | Array of partition objects that should be installed per partition |
| filesystem | string | true | File system in which partition would be mounted |
| size | integer | true | Size of the partition (Normally in MB, but this is OS-specific) |
| mountpoint | string | false | The partition mount point (eg `/home`). Mandatory for the root partition (`/`) and not intended to be used in swap partition |
| bootable | boolean | false | Flag indicating if partition is bootable or not |
| primary | boolean | false | Flag indicating if partition is primary or not |
| raid | object | false | Contains RAID related information about the installation request |
| type | string | true | RAID type to apply to your installation. (Allowed values: HW,SW,NONE) |
| level | integer | false | RAID level to apply to your installation, this value is only required if you specify a type HW or SW (Allowed values: 0,1,5,10) |
| numberOfDisks | integer | false | The number of disks you want to apply RAID on. If not specified all disks are used. Only supported for HW raids. |
| powerCycle | boolean | false | If true, allows system reboots to happen automatically within the process. Otherwise, you should do them manually |
| callbackUrl | string | false | Url which will receive callbacks when the installation is finished or failed |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/rescueModeREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/rescueMode \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"rescueImageId": "GRML",
"callbackUrl": "https://example.com/urlExecutedOnCallback",
"sshKeys": "ssh-rsa AAAAB3NzaC1y... user@domain.com",
"powerCycle" : true
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/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 => "{ \"rescueImageId\": \"GRML\", \"callbackUrl\": \"https://example.com/urlExecutedOnCallback\", \"sshKeys\": \"ssh-rsa AAAAB3NzaC1y... user@domain.com\", \"powerCycle\" : true}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"rescueImageId\": \"GRML\", \"callbackUrl\": \"https://example.com/urlExecutedOnCallback\", \"sshKeys\": \"ssh-rsa AAAAB3NzaC1y... user@domain.com\", \"powerCycle\" : true}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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"] = 'application/json'
request.body = "{ \"rescueImageId\": \"GRML\", \"callbackUrl\": \"https://example.com/urlExecutedOnCallback\", \"sshKeys\": \"ssh-rsa AAAAB3NzaC1y... user@domain.com\", \"powerCycle\" : true}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"serverId": "2349839",
"createdAt": "2018-03-06T22:53:31+0000",
"flow": "tasks",
"isRunning": true,
"node": "AA:BB:CC:DD:EE:FF!JKDJFK890",
"payload": {
"isUnassignedServer": false,
"jobType": "rescueMode",
"pop": "AMS-01",
"powerCycle": true,
"serverId": "2349839",
"tftpBaseUrl": "10.11.20.2"
},
"progress": {
"canceled": 0,
"expired": 0,
"failed": 0,
"finished": 0,
"inprogress": 0,
"pending": 1,
"percentage": 0,
"total": 12,
"waiting": 11
},
"status": "ACTIVE",
"tasks": [
{
"uuid": "8a10b74b-2a94-4a3b-88da-b9c07faa240d",
"status": "PENDING",
"description": "dummy",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T10:38:12+00:00",
"PENDING": "2018-01-09T10:38:12+00:00"
}
}
],
"type": "rescueMode",
"updatedAt": "2018-03-06T22:53:31+0000",
"uuid": "ac99431b-640d-4282-95a9-a444eedb9309"
}
POSTLaunch rescue mode
Launch rescue mode for your server. Rescue mode allows you to trouble shoot your server in case your installed operating system is no longer reachable.
After a rescue mode is launched you can manually reboot the server. After this reboot the server will boot into the existing operating system.
To get a list of available rescue images, you could do so by sending a GET
request to /bareMetals/v2/rescueImages.
On success, the response will be a 202 Accepted containing the scheduled job
definition.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| rescueImageId | string | true | |
| password | string | false | |
| sshKeys | string | false | |
| callbackUrl | string | false | Callback URL |
| powerCycle | boolean | false | PowerCycle |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareScanREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareScan \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"powerCycle": false
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareScan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"powerCycle\": false}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"powerCycle\": false}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/12345/hardwareScan", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/hardwareScan")
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"] = 'application/json'
request.body = "{ \"powerCycle\": false}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"progress": {
"total": 5,
"waiting": 4,
"pending": 1,
"inprogress": 0,
"finished": 0,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 0
},
"isRunning": true,
"status": "ACTIVE",
"uuid": "2dcca92d-b5df-4837-bd99-b568ac54569a",
"type": "hardwareScan",
"serverId": "99944",
"node": "80:18:44:E0:AF:C4!JGNTQ92",
"payload": {
"powerCycle": true,
"jobType": "hardwareScan",
"serverId": "99944",
"pop": "AMS-01",
"tftpBaseUrl": ""
},
"createdAt": "2018-01-09T09:07:09+0000",
"updatedAt": "2018-01-09T09:07:09+0000",
"tasks": [
{
"uuid": "8a10b74b-2a94-4a3b-88da-b9c07faa240d",
"status": "PENDING",
"description": "dummy",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T10:38:12+00:00",
"PENDING": "2018-01-09T10:38:12+00:00"
}
}
],
"flow": "tasks"
}
POSTLaunch hardware scan
To run a hardware scan for this server you can use this API.
A hardware scan collects hardware related information from your server.
A hardware scan will require a reboot of your server. The contents of your hard drive wont be altered in any way. After a successful hardware scan your server is booted back into the original operating system.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| callbackUrl | string | false | Callback URL |
| powerCycle | boolean | false | PowerCycle |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/ipmiResetREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/ipmiReset \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"callbackUrl": "https://callbacks.example.org"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/ipmiReset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"callbackUrl\": \"https://callbacks.example.org\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"callbackUrl\": \"https://callbacks.example.org\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/12345/ipmiReset", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/ipmiReset")
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"] = 'application/json'
request.body = "{ \"callbackUrl\": \"https://callbacks.example.org\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 1,
"inprogress": 0,
"finished": 0,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 0
},
"isRunning": true,
"status": "ACTIVE",
"uuid": "754154c2-cc7f-4d5f-b8bf-b654084ba4a9",
"type": "ipmiReset",
"serverId": "99944",
"node": "80:18:44:E0:AF:C4!JGNTQ92",
"payload": {
"powerCycle": true,
"jobType": "ipmiReset",
"hasPublicIpmiIp": false,
"serverId": "99944",
"pop": "AMS-01",
"tftpBaseUrl": ""
},
"createdAt": "2018-01-09T09:18:06+0000",
"updatedAt": "2018-01-09T09:18:06+0000",
"tasks": [
{
"uuid": "c1a56a5a-ae38-4b12-acb6-0cba9ceb1016",
"status": "PENDING",
"description": "dummy",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T09:18:06+00:00",
"PENDING": "2018-01-09T09:18:06+00:00"
}
}
],
"flow": "tasks"
}
POSTLaunch IPMI reset
To reset the IPMI credentials and your IPMI interface of this server you can use this API.
A reset makes sure that your IPMI interface of you server is compatible with Leaseweb automation and secure.
An IPMI reset will require a reboot of your server. The contents of your hard drive wont be altered in any way. After a successful IPMI reset your server is booted back into the original operating system.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| callbackUrl | string | false | Callback URL |
| powerCycle | boolean | false | PowerCycle |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/powerInfoREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/powerInfo \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/powerInfo",
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", "/bareMetals/v2/servers/12345/powerInfo", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/powerInfo")
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
{
"pdu": {
"status": "on"
}
}
GETPower Status For Server
This API allows you to query the current power status of the server.
The server can either be ON or OFF. Servers can be powered on or off by
using the respective /powerOn and /powerOff API calls. In addition servers
can also be rebooted using the /powerCycle API call.
The pdu object describes the power status from the power distribution unit
(PDU) point of view. If your server is connected to multiple PDU ports the
status property will report on if at least one PDU port has power.
Note that pdu.status can report on but your server can still be powered off
if it was shutdown via IPMI for example.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| pdu | object | Object describing the PDU power information |
| status | string | The current power status of the server. |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/powerCycleREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/powerCycle \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"callbackUrl": "https://callbacks.example.com"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/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_POSTFIELDS => "{ \"callbackUrl\": \"https://callbacks.example.com\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"callbackUrl\": \"https://callbacks.example.com\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/12345/powerCycle", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/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'
request["content-type"] = 'application/json'
request.body = "{ \"callbackUrl\": \"https://callbacks.example.com\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 0,
"inprogress": 0,
"finished": 1,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 100
},
"isRunning": false,
"status": "FINISHED",
"uuid": "e873538a-0447-4f96-98e0-a12618759b0c",
"type": "powercycle",
"serverId": "37965",
"node": "00:25:90:2D:5B:38",
"payload": {
"powerCycle": true,
"jobType": "powercycle",
"serverId": "37965",
"pop": "AMS-01",
"tftpBaseUrl": "10.11.20.2"
},
"createdAt": "2018-01-10T09:54:37+0000",
"updatedAt": "2018-01-10T09:54:37+0000",
"tasks": [
{
"uuid": "e5407f11-6207-4e7c-9b56-75715e23722e",
"status": "FINISHED",
"description": "Power cycle the server",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-10T09:54:37+00:00",
"FINISHED": "2018-01-10T09:54:37+00:00"
}
}
],
"flow": "#stop"
}
POSTPower cycle server
Power cycle your server. You can optionally specify a callbackUrl so you will
be notified when the power cycle was executed successfully.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| callbackUrl | string | false | Callback URL |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/powerOnREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/powerOn \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"callbackUrl": "https://callbacks.example.com"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/powerOn",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"callbackUrl\": \"https://callbacks.example.com\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"callbackUrl\": \"https://callbacks.example.com\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/12345/powerOn", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/powerOn")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["X-Lsw-Auth"] = '213423-2134234-234234-23424'
request["content-type"] = 'application/json'
request.body = "{ \"callbackUrl\": \"https://callbacks.example.com\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 0,
"inprogress": 0,
"finished": 1,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 100
},
"isRunning": false,
"status": "FINISHED",
"uuid": "98bae0d6-58b5-4fa2-b17d-68c8e5ab73d0",
"type": "poweron",
"serverId": "37965",
"node": "00:25:90:2D:5B:38",
"payload": {
"powerCycle": true,
"jobType": "poweron",
"serverId": "37965",
"pop": "AMS-01",
"tftpBaseUrl": "10.11.20.2"
},
"createdAt": "2018-01-10T10:15:46+0000",
"updatedAt": "2018-01-10T10:15:46+0000",
"tasks": [
{
"uuid": "b2a75f74-9f35-44e5-a502-6c05902eb1d9",
"status": "FINISHED",
"description": "Power on the server",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-10T10:15:46+00:00",
"FINISHED": "2018-01-10T10:15:46+00:00"
}
}
],
"flow": "#stop"
}
POSTPower on server
Power on your server. You can optionally specify a callbackUrl so you will be notified when the power on was executed successfully.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| callbackUrl | string | false | Callback URL |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/powerOffREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/powerOff \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"callbackUrl": "https://callbacks.example.com"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/powerOff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"callbackUrl\": \"https://callbacks.example.com\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"callbackUrl\": \"https://callbacks.example.com\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/12345/powerOff", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/powerOff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["X-Lsw-Auth"] = '213423-2134234-234234-23424'
request["content-type"] = 'application/json'
request.body = "{ \"callbackUrl\": \"https://callbacks.example.com\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 0,
"inprogress": 0,
"finished": 1,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 100
},
"isRunning": false,
"status": "FINISHED",
"uuid": "fafadbe0-cb32-43d0-891f-ce04a06f4c05",
"type": "poweroff",
"serverId": "37965",
"node": "00:25:90:2D:5B:38",
"payload": {
"powerCycle": true,
"jobType": "poweroff",
"serverId": "37965",
"pop": "AMS-01",
"tftpBaseUrl": "10.11.20.2"
},
"createdAt": "2018-01-10T10:15:08+0000",
"updatedAt": "2018-01-10T10:15:08+0000",
"tasks": [
{
"uuid": "7fea0f05-e136-4a10-84e6-4a1761b9a325",
"status": "FINISHED",
"description": "Power off the server",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-10T10:15:08+00:00",
"FINISHED": "2018-01-10T10:15:08+00:00"
}
}
],
"flow": "#stop"
}
POSTPower off server
Power off your server. You can optionally specify a callbackUrl so you will be notified when the power off was executed successfully.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| callbackUrl | string | false | Callback URL |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/nullRouteHistoryREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/nullRouteHistory \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/nullRouteHistory",
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", "/bareMetals/v2/servers/12345/nullRouteHistory", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/nullRouteHistory")
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": {
"limit": 10,
"offset": 0,
"totalCount": 1
},
"nullRoutes": [
{
"automatedUnnullingAt": "2016-08-12T07:45:33+00:00",
"comment": "Device Null Route related to DDoS Mitigation",
"ip": "1.1.1.1/32",
"nullLevel": 3,
"nulledAt": "2016-08-12T07:40:27+00:00",
"ticketId": "282912"
}
]
}
GETNull Route History
Retrieve null route history of the server
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/credentialsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials",
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", "/bareMetals/v2/servers/12345/credentials", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials")
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": {
"limit": 10,
"offset": 0,
"totalCount": 4
},
"credentials": [
{
"type": "REMOTE_MANAGEMENT",
"username": "admin"
},
{
"type": "REMOTE_MANAGEMENT",
"username": "root"
},
{
"type": "OPERATING_SYSTEM",
"username": "root"
},
{
"type": "OPERATING_SYSTEM",
"username": "user"
}
]
}
GETList credentials
List all the credentials for the given resource, optionally filtered by type.
The credentials API allows you to store usernames and passwords securely.
During (re)installations the newly generated passwords are stored and can be retrieved using this API.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/credentialsREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"type": "OPERATING_SYSTEM",
"username": "root",
"password": "my-secret-password"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"type\": \"OPERATING_SYSTEM\", \"username\": \"root\", \"password\": \"my-secret-password\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"type\": \"OPERATING_SYSTEM\", \"username\": \"root\", \"password\": \"my-secret-password\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/12345/credentials", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials")
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"] = 'application/json'
request.body = "{ \"type\": \"OPERATING_SYSTEM\", \"username\": \"root\", \"password\": \"my-secret-password\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"password": "mys3cr3tp@ssw0rd",
"type": "OPERATING_SYSTEM",
"username": "root"
}
POSTAdd credentials
Create a new set of credentials (username/password) associated to the given resource.
These credentials can later be retrieved by sending a GET request to the same endpoint.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| type | string | true | The type of the credential (Allowed values: OPERATING_SYSTEM,CONTROL_PANEL,REMOTE_MANAGEMENT,RESCUE_MODE,SWITCH,PDU,FIREWALL,LOAD_BALANCER) |
| username | string | true | The username for the credentials |
| password | string | true | The password for the credentials |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| type | string | The type of credentials |
| username | string | The username |
| password | string | The password |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEMREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM",
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", "/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM")
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": {
"limit": 10,
"offset": 0,
"totalCount": 1
},
"credentials": [
{
"type": "OPERATING_SYSTEM",
"username": "root"
}
]
}
GETList credentials by type
List all the credentials for the given resource, optionally filtered by type.
The credentials API allows you to store usernames and passwords securely.
During (re)installations the newly generated passwords are stored and can be retrieved using this API.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/rootREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root",
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", "/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root")
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
{
"password": "mys3cr3tp@ssw0rd",
"type": "OPERATING_SYSTEM",
"username": "root"
}
GETShow credential
Get the username and password for the given credentials.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| type | string | The type of credentials |
| username | string | The username |
| password | string | The password |
PUThttps://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/rootREQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"password": "Y5TurbBQtP5OzvduSH6g"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "{ \"password\": \"Y5TurbBQtP5OzvduSH6g\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"password\": \"Y5TurbBQtP5OzvduSH6g\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root")
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"] = 'application/json'
request.body = "{ \"password\": \"Y5TurbBQtP5OzvduSH6g\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"password": "mys3cr3tp@ssw0rd",
"type": "OPERATING_SYSTEM",
"username": "root"
}
PUTUpdate credential
Update the password for the given credentials. Note that usernames or types cannot be changed. In order to change those remove this credentials and create a new one.
Note that this action is purely administrative and will only update the password associated with this resource in our database.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| password | string | true | The password for the credentials |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| type | string | The type of credentials |
| username | string | The username |
| password | string | The password |
DELETEhttps://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/rootREQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root",
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", "/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/credentials/OPERATING_SYSTEM/root")
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 credentials
Remove credentials from this resource.
On success, the response will have HTTP status code of 204 No Content
Note that this action is purely administrative and will only remove the username and password associated with this resource from our database.
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/ipsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/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/bareMetals/v2/servers/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", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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
{
"_metadata": {
"limit": 10,
"offset": 0,
"totalCount": 2
},
"ips": [
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": true,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
},
{
"ip": "2001:db8:85a3::8a2e:370:7334/64",
"gateway": "2001:db8:85a3::8a2e:370:1",
"version": 6,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": false,
"networkType": "REMOTE_MANAGEMENT"
}
]
}
GETAll IPs
List all the ip addresses associated with the given resource.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| networkType | public | Filter the collection of ip addresses by network type (Allowed values: public,internal,remoteManagement) |
| version | Filter the collection by ip version (Allowed values: 4,6) | |
| nullRouted | true | Filter Ips by Nulled-Status (Allowed values: true,false) |
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| ips | array | An array of IP addresses |
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123",
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", "/bareMetals/v2/servers/12345/ips/123.123.123.123", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123")
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": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
GETSingle IP
Retrieve a single IP Address that is associated with the given resource.
An IP Address can be null routed and the reverse lookup record can be updated.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
PUThttps://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"reverseLookup": "domain.example.com"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123",
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\": \"domain.example.com\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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\": \"domain.example.com\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/servers/12345/ips/123.123.123.123", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123")
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"] = 'application/json'
request.body = "{ \"reverseLookup\": \"domain.example.com\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
PUTUpdate IP
Update the reverse lookup for the ip address.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| reverseLookup | string | true | The reverse lookup value |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/nullREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/null \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/null",
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", "/bareMetals/v2/servers/12345/ips/123.123.123.123/null", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/null")
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
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
POSTNull IP
Null the ip address. It will take a while before the change is propagated across the network.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/unnullREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/unnull \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/unnull",
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", "/bareMetals/v2/servers/12345/ips/123.123.123.123/unnull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/ips/123.123.123.123/unnull")
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
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
POSTUnnull IP
Remove an existing null route for the ip address. It will take a while before the change is propagated across the network.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/jobsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/jobs \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/jobs",
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", "/bareMetals/v2/servers/12345/jobs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/jobs")
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
},
"jobs": [
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 1,
"inprogress": 0,
"finished": 0,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 0
},
"isRunning": true,
"status": "ACTIVE",
"uuid": "3a867358-5b4b-44ee-88ac-4274603ef641",
"type": "install",
"serverId": "99944",
"node": "80:18:44:E0:AF:C4!JGNTQ92",
"createdAt": "2018-01-09T10:38:12+0000",
"updatedAt": "2018-01-09T10:38:12+0000",
"flow": "tasks"
}
]
}
GETList Jobs
Retrieve all jobs for server.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| jobs | array | An array of jobs |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/jobs/3a867358-5b4b-44ee-88ac-4274603ef641REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/jobs/3a867358-5b4b-44ee-88ac-4274603ef641 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/jobs/3a867358-5b4b-44ee-88ac-4274603ef641",
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", "/bareMetals/v2/servers/12345/jobs/3a867358-5b4b-44ee-88ac-4274603ef641", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/jobs/3a867358-5b4b-44ee-88ac-4274603ef641")
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
{
"progress": {
"total": 1,
"waiting": 0,
"pending": 1,
"inprogress": 0,
"finished": 0,
"failed": 0,
"expired": 0,
"canceled": 0,
"percentage": 0
},
"isRunning": true,
"status": "ACTIVE",
"uuid": "3a867358-5b4b-44ee-88ac-4274603ef641",
"type": "install",
"serverId": "99944",
"node": "80:18:44:E0:AF:C4!JGNTQ92",
"payload": {
"powerCycle": true,
"jobType": "install",
"configurable": true,
"device": "/my/ubuntu/device",
"os": {
"type": "linux",
"name": "Ubuntu 14.04 LTS (Trusty Tahr) (x86)",
"family": "ubuntu",
"version": "14.04",
"architecture": "32bit"
},
"partitions": [
{
"size": 4096,
"filesystem": "swap"
}
],
"raidLevel": null,
"numberOfDisks": null,
"operatingSystemId": "UBUNTU_1404_32X86",
"serverId": "99944",
"pop": "AMS-01",
"tftpBaseUrl": "",
"timezone": "UTC",
"x": 1
},
"createdAt": "2018-01-09T10:38:12+0000",
"updatedAt": "2018-01-09T10:38:12+0000",
"tasks": [
{
"uuid": "8a10b74b-2a94-4a3b-88da-b9c07faa240d",
"status": "PENDING",
"description": "dummy",
"onError": "break",
"errorMessage": null,
"flow": "tasks",
"statusTimestamps": {
"WAITING": "2018-01-09T10:38:12+00:00",
"PENDING": "2018-01-09T10:38:12+00:00"
}
}
],
"flow": "tasks"
}
GETGet single Job
Retrieve detailed information about a job for this server.
This API can be used to keep track of the progress of an active job.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| uuid | string | Unique identifier of the job |
| serverId | string | Id of the server |
| bareMetalId | string | Id of the server (deprecated, use serverId instead) |
| type | string | Type of the job |
| node | string | Node ID for this server |
| isRunning | boolean | Describes whether the job is running |
| status | string | Status of the bjo |
| payload | object | Payload of the current job |
| progress | object | Describes progress of the jobs on the server |
| createdAt | datetime | Creation timestamp |
| updatedAt | datetime | Update timestamp |
| tasks | array | List of tasks in the job |
| uuid | string | Unique ID for this task |
| description | string | Description of the task |
| errorMessage | string | An optional error message |
| flow | string | The flow this task is part of |
| onError | string | The behaviour if this task fails |
| status | string | The status of the task |
| statusTimestamps | object | Timestamp for each state change |
| flow | string | Job flow |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/leasesREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/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/bareMetals/v2/servers/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", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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",
"id": "67",
"userClass": "",
"value": "undionly.kpxe"
},
{
"name": "DNS Servers",
"id": "6",
"userClass": "",
"value": "8.8.8.8, 8.8.8.4"
},
{
"name": "Boot Server Host Name",
"id": "66",
"userClass": "",
"value": "192.168.0.150"
},
{
"name": "Bootfile Name",
"id": "67",
"userClass": "gPXE",
"value": "http://95.211.51.8/server/getPxeConfig/serverId/11895/key/bf59bdac764fe8ab62646fce063d8429"
}
],
"scope": "192.168.0.64"
}
]
}
GETList Leases
Show the current DHCP leasese for this server.
Please note that this will only show leases on the public network.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| leases | array | An array of active DHCP leases |
| ip | string | The assigned IP for the DHCP lease |
| mac | string | The MAC address the DHCP lease is assigned to |
| options | string | An array of DHCP lease options |
| name | string | Name of the DHCP option |
| id | string | DHCP option identifier |
| userClass | string | DHCP option user class |
| value | string | DHCP option value |
| scope | string | The scope of the DHCP lease |
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/leasesREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/leases \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"bootFileName": "http://example.com/bootme.ipxe",
"bootServerHostName": "my-server",
"domainNameServerIp": "8.8.8.8"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/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://example.com/bootme.ipxe\", \"bootServerHostName\": \"my-server\", \"domainNameServerIp\": \"8.8.8.8\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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://example.com/bootme.ipxe\", \"bootServerHostName\": \"my-server\", \"domainNameServerIp\": \"8.8.8.8\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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"] = 'application/json'
request.body = "{ \"bootFileName\": \"http://example.com/bootme.ipxe\", \"bootServerHostName\": \"my-server\", \"domainNameServerIp\": \"8.8.8.8\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
If the lease was created succesfully a 204 No Content is returned.
POSTCreate DHCP Lease
This will allow you to create a DHCP lease for your server's public network interface.
After rebooting your server it will acquire this DHCP lease and boot from the
specified bootFileName url.
Please note that this API call will not reboot or power cycle your server.
On success the reponse will be a HTTP 204 No Content.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| bootFileName | string | true | The URL of PXE boot you want your server to boot from |
| bootServerHostName | string | false | The Boot Server Host Name (option 066) for the server |
| domainNameServerIp | string | false | The Domain Name Server IP used |
DELETEhttps://api.leaseweb.com/bareMetals/v2/servers/12345/leasesREQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/bareMetals/v2/servers/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/bareMetals/v2/servers/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", "/bareMetals/v2/servers/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/bareMetals/v2/servers/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
If the lease was deleted succesfully a 204 No Content is returned.
DELETEDelete DHCP lease
Delete a DHCP lease for this server. The next time the server boots it will not
network boot from the bootFileName.
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/metrics/datatrafficREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/metrics/datatraffic \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/metrics/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", "/bareMetals/v2/servers/12345/metrics/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/bareMetals/v2/servers/12345/metrics/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
{
"_metadata": {
"from": "2016-10-20T09:00:00Z",
"to": "2016-10-20T11:00:00Z",
"granularity": "HOUR",
"aggregation": "SUM"
},
"metrics": {
"UP_PUBLIC": {
"unit": "B",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 43212393
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 12342929
}
]
},
"DOWN_PUBLIC": {
"unit": "B",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 202499
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 29900
}
]
}
}
}
GETDatatraffic metrics
This endpoint exposes data traffic information for the given resource. Based
on the granularity query string parameter either a single value or multiple
values are returned.
Note that at this moment only bandwidth information for the public interface is supported.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| from | 2016-01-01T00:00:00Z | Start of date interval in ISO-8601 format The returned data will include everything up from - and including - the specified date time. |
| to | 2016-01-02T00:00:00Z | End of date interval in ISO-8601 format. The returned data will include everything up until - but not including - the specified date time. |
| granularity | Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: DAY) | |
| aggregation | Aggregate each metric using the given aggregation function. (Allowed values: SUM) |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/metrics/bandwidthREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/metrics/bandwidth \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/metrics/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", "/bareMetals/v2/servers/12345/metrics/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/bareMetals/v2/servers/12345/metrics/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
{
"_metadata": {
"from": "2016-10-20T09:00:00Z",
"to": "2016-10-20T11:00:00Z",
"granularity": "HOUR",
"aggregation": "AVG"
},
"metrics": {
"UP_PUBLIC": {
"unit": "bps",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 43212393
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 12342929
}
]
},
"DOWN_PUBLIC": {
"unit": "bps",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 202499
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 29900
}
]
}
}
}
GETBandwidth metrics
This endpoint exposes bandwidth information for the given resource. Based on
the granularity query string parameter either a single value or multiple
values are returned.
Note that at this moment only bandwidth information for the public interface is supported.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| from | 2016-01-01T00:00:00Z | Start of date interval in ISO-8601 format The returned data will include everything up from - and including - the specified date time. |
| to | 2016-01-02T00:00:00Z | End of date interval in ISO-8601 format. The returned data will include everything up until - but not including - the specified date time. |
| granularity | Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: 5MIN,HOUR,DAY,WEEK,MONTH,YEAR) | |
| aggregation | Aggregate each metric using the given aggregation function. When the aggregation type `95TH` is specified the granularity parameter should be omitted from the request. (Allowed values: AVG,95TH) |
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfacesREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces",
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", "/bareMetals/v2/servers/12345/networkInterfaces", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces")
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": {
"limit": 10,
"offset": 0,
"totalCount": 1
},
"networkInterfaces": [
{
"linkSpeed": "100Mbps",
"status": "OPEN",
"switchInterface": "33",
"switchName": "EVO-AA11-1",
"type": "PUBLIC"
}
]
}
GETAll network interfaces
Retrieve the status for all network interfaces status for the given resource.
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/openREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/open \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/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", "/bareMetals/v2/servers/12345/networkInterfaces/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/bareMetals/v2/servers/12345/networkInterfaces/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
No Content
POSTOpen or close all network interfaces
Open or close all network interfaces for the given resource.
On success, the response will have HTTP 204 No content status
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/publicREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/public \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/public",
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", "/bareMetals/v2/servers/12345/networkInterfaces/public", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/public")
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
{
"linkSpeed": "100Mbps",
"status": "OPEN",
"switchInterface": "33",
"switchName": "EVO-JV12-1",
"type": "PUBLIC"
}
GETStatus for network interface
Retrieve the status for a single network interfaces status for the given resource.
POSThttps://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/public/openREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/public/open \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/networkInterfaces/public/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", "/bareMetals/v2/servers/12345/networkInterfaces/public/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/bareMetals/v2/servers/12345/networkInterfaces/public/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
No Content
POSTOpen or close network interface
Open or close all network interfaces for the given resource.
On success, the response will have HTTP 204 No content status
GEThttps://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddosREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddos \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddos",
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", "/bareMetals/v2/servers/12345/notificationSettings/ddos", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddos")
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
{
"nulling": "ENABLED",
"scrubbing": "DISABLED"
}
GETGet DDoS Notification Settings
On success the response will be an object with the current DDoS notification setting for this resource.
Notifications will be sent to all technical contact email addresses of the customer.
PUThttps://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddosREQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddos \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"scrubbing": "ENABLED",
"nulling": "DISABLED"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "{ \"scrubbing\": \"ENABLED\", \"nulling\": \"DISABLED\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"scrubbing\": \"ENABLED\", \"nulling\": \"DISABLED\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/servers/12345/notificationSettings/ddos", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/servers/12345/notificationSettings/ddos")
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"] = 'application/json'
request.body = "{ \"scrubbing\": \"ENABLED\", \"nulling\": \"DISABLED\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
If the new settings are stored successfully, a 204 No Content is returned.
PUTManage DDoS notifications Settings
To configure DDoS notification for this resource, send a PUT request. On
success the response will be a HTTP 204 No Content.
Notifications will be sent to all technical contact email addresses of the customer.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| scrubbing | string | true | Enable or disable email notifications for nulling events (Allowed values: ENABLED,DISABLED) |
| nulling | string | true | Enable or disable email notifications for nulling events (Allowed values: ENABLED,DISABLED) |
Private Rack API
This API can be used to manage your private racks
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacksREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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
{
"_metadata": {
"limit": 20,
"offset": 0,
"totalCount": 2
},
"privateRacks": [
{
"contract": {
"customerId": "2738283",
"deliveryStatus": "ACTIVE",
"id": "123456",
"internalReference": "AAAA - Private rack 001",
"reference": null,
"salesOrgId": "2000"
},
"featureAvailability": {
"powerCycle": false,
"privateNetwork": false
},
"id": "123456",
"location": {
"rack": "22",
"site": "AMS-01",
"suite": "8.24"
},
"networkInterfaces": {
"public": {
"ports": [
{
"name": "EVO-BB99-1",
"port": "0-9"
}
]
}
}
},
{
"contract": {
"customerId": "2738283",
"deliveryStatus": "ACTIVE",
"id": "267940",
"internalReference": "AAAA - Private rack 002",
"reference": null,
"salesOrgId": "2000"
},
"featureAvailability": {
"powerCycle": false,
"privateNetwork": false
},
"id": "267940",
"location": {
"rack": "MX66",
"site": "AMS-01",
"suite": "Hall3"
},
"networkInterfaces": {
"public": {
"ports": [
{
"name": "ce99.ams-01",
"port": "0-1"
}
]
}
}
}
]
}
GETList all private racks
This API returns a paginated list of all private racks.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/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/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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
{
"contract": {
"customerId": "2738283",
"deliveryStatus": "ACTIVE",
"endsAt": null,
"id": "2893829",
"internalReference": "AAAA - Private rack 002",
"networkTraffic": {
"datatrafficLimit": 0,
"datatrafficUnit": null,
"trafficType": "CUSTOM",
"type": "CONNECTIVITY"
},
"reference": null,
"salesOrgId": "2000",
"sla": "Platinum - 24x7x½",
"startsAt": "2017-08-01T00:00:00"
},
"featureAvailability": {
"powerCycle": false,
"privateNetwork": false
},
"id": "2893829",
"location": {
"rack": "MI15",
"site": "AMS-01",
"suite": "Hall3"
},
"networkInterfaces": {
"public": {
"ports": [
{
"name": "ce05.ams-01",
"port": "0-26"
}
]
}
},
"powerPorts": []
}
GETGet Private Rack
Retrieve information about a single private rack.
PUThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"reference": "production"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/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\": \"production\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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\": \"production\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/privateRacks/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/bareMetals/v2/privateRacks/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"] = 'application/json'
request.body = "{ \"reference\": \"production\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
If the reference was succesfully set a 204 No Content is returned
PUTUpdate reference
This API call allows you to update the reference for a private rack. A
reference can be used to uniquely identify a private rack with a name, such as
production.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| reference | string | true | The reference for this private rack |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ipsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/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/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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
{
"_metadata": {
"limit": 10,
"offset": 0,
"totalCount": 2
},
"ips": [
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": true,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
},
{
"ip": "2001:db8:85a3::8a2e:370:7334/64",
"gateway": "2001:db8:85a3::8a2e:370:1",
"version": 6,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": false,
"networkType": "REMOTE_MANAGEMENT"
}
]
}
GETAll IPs
List all the ip addresses associated with the given resource.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| networkType | public | Filter the collection of ip addresses by network type (Allowed values: public,internal,remoteManagement) |
| version | Filter the collection by ip version (Allowed values: 4,6) | |
| nullRouted | true | Filter Ips by Nulled-Status (Allowed values: true,false) |
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| ips | array | An array of IP addresses |
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123",
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", "/bareMetals/v2/privateRacks/12345/ips/123.123.123.123", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123")
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": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
GETSingle IP
Retrieve a single IP Address that is associated with the given resource.
An IP Address can be null routed and the reverse lookup record can be updated.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
PUThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"reverseLookup": "domain.example.com"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123",
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\": \"domain.example.com\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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\": \"domain.example.com\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/privateRacks/12345/ips/123.123.123.123", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123")
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"] = 'application/json'
request.body = "{ \"reverseLookup\": \"domain.example.com\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
PUTUpdate IP
Update the reverse lookup for the ip address.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| reverseLookup | string | true | The reverse lookup value |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
POSThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/nullREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/null \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/null",
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", "/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/null", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/null")
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
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
POSTNull IP
Null the ip address. It will take a while before the change is propagated across the network.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
POSThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/unnullREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/unnull \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/unnull",
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", "/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/unnull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/ips/123.123.123.123/unnull")
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
{
"ip": "12.123.123.1/24",
"gateway": "12.123.123.254",
"version": 4,
"nullRouted": false,
"reverseLookup": "domain.example.com",
"mainIp": true,
"networkType": "PUBLIC"
}
POSTUnnull IP
Remove an existing null route for the ip address. It will take a while before the change is propagated across the network.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| ip | string | IP address in CIDR notation |
| gateway | string | Gateway |
| version | string | IP version |
| nullRouted | boolean | IP address null routed |
| mainIp | boolean | IP address is main |
| networkType | string | Type of network (Allowed values: PUBLIC,REMOTE_MANAGEMENT) |
| reverseLookup | string | The reverse lookup value |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentialsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials",
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", "/bareMetals/v2/privateRacks/12345/credentials", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials")
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": {
"limit": 10,
"offset": 0,
"totalCount": 4
},
"credentials": [
{
"type": "REMOTE_MANAGEMENT",
"username": "admin"
},
{
"type": "REMOTE_MANAGEMENT",
"username": "root"
},
{
"type": "OPERATING_SYSTEM",
"username": "root"
},
{
"type": "OPERATING_SYSTEM",
"username": "user"
}
]
}
GETList credentials
List all the credentials for the given resource, optionally filtered by type.
The credentials API allows you to store usernames and passwords securely.
During (re)installations the newly generated passwords are stored and can be retrieved using this API.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
POSThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentialsREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"type": "OPERATING_SYSTEM",
"username": "root",
"password": "my-secret-password"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"type\": \"OPERATING_SYSTEM\", \"username\": \"root\", \"password\": \"my-secret-password\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"type\": \"OPERATING_SYSTEM\", \"username\": \"root\", \"password\": \"my-secret-password\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/privateRacks/12345/credentials", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials")
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"] = 'application/json'
request.body = "{ \"type\": \"OPERATING_SYSTEM\", \"username\": \"root\", \"password\": \"my-secret-password\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"password": "mys3cr3tp@ssw0rd",
"type": "OPERATING_SYSTEM",
"username": "root"
}
POSTAdd credentials
Create a new set of credentials (username/password) associated to the given resource.
These credentials can later be retrieved by sending a GET request to the same endpoint.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| type | string | true | The type of the credential (Allowed values: OPERATING_SYSTEM,CONTROL_PANEL,REMOTE_MANAGEMENT,RESCUE_MODE,SWITCH,PDU,FIREWALL,LOAD_BALANCER) |
| username | string | true | The username for the credentials |
| password | string | true | The password for the credentials |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| type | string | The type of credentials |
| username | string | The username |
| password | string | The password |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEMREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM",
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", "/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM")
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": {
"limit": 10,
"offset": 0,
"totalCount": 1
},
"credentials": [
{
"type": "OPERATING_SYSTEM",
"username": "root"
}
]
}
GETList credentials by type
List all the credentials for the given resource, optionally filtered by type.
The credentials API allows you to store usernames and passwords securely.
During (re)installations the newly generated passwords are stored and can be retrieved using this API.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/rootREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root",
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", "/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root")
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
{
"password": "mys3cr3tp@ssw0rd",
"type": "OPERATING_SYSTEM",
"username": "root"
}
GETShow credential
Get the username and password for the given credentials.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| type | string | The type of credentials |
| username | string | The username |
| password | string | The password |
PUThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/rootREQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"password": "Y5TurbBQtP5OzvduSH6g"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "{ \"password\": \"Y5TurbBQtP5OzvduSH6g\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"password\": \"Y5TurbBQtP5OzvduSH6g\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root")
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"] = 'application/json'
request.body = "{ \"password\": \"Y5TurbBQtP5OzvduSH6g\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"password": "mys3cr3tp@ssw0rd",
"type": "OPERATING_SYSTEM",
"username": "root"
}
PUTUpdate credential
Update the password for the given credentials. Note that usernames or types cannot be changed. In order to change those remove this credentials and create a new one.
Note that this action is purely administrative and will only update the password associated with this resource in our database.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| password | string | true | The password for the credentials |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| type | string | The type of credentials |
| username | string | The username |
| password | string | The password |
DELETEhttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/rootREQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root",
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", "/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/credentials/OPERATING_SYSTEM/root")
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 credentials
Remove credentials from this resource.
On success, the response will have HTTP status code of 204 No Content
Note that this action is purely administrative and will only remove the username and password associated with this resource from our database.
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/metrics/datatrafficREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/metrics/datatraffic \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/metrics/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", "/bareMetals/v2/privateRacks/12345/metrics/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/bareMetals/v2/privateRacks/12345/metrics/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
{
"_metadata": {
"from": "2016-10-20T09:00:00Z",
"to": "2016-10-20T11:00:00Z",
"granularity": "HOUR",
"aggregation": "SUM"
},
"metrics": {
"UP_PUBLIC": {
"unit": "B",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 43212393
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 12342929
}
]
},
"DOWN_PUBLIC": {
"unit": "B",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 202499
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 29900
}
]
}
}
}
GETDatatraffic metrics
This endpoint exposes data traffic information for the given resource. Based
on the granularity query string parameter either a single value or multiple
values are returned.
Note that at this moment only bandwidth information for the public interface is supported.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| from | 2016-01-01T00:00:00Z | Start of date interval in ISO-8601 format The returned data will include everything up from - and including - the specified date time. |
| to | 2016-01-02T00:00:00Z | End of date interval in ISO-8601 format. The returned data will include everything up until - but not including - the specified date time. |
| granularity | Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: DAY) | |
| aggregation | Aggregate each metric using the given aggregation function. (Allowed values: SUM) |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/metrics/bandwidthREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/metrics/bandwidth \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/metrics/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", "/bareMetals/v2/privateRacks/12345/metrics/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/bareMetals/v2/privateRacks/12345/metrics/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
{
"_metadata": {
"from": "2016-10-20T09:00:00Z",
"to": "2016-10-20T11:00:00Z",
"granularity": "HOUR",
"aggregation": "AVG"
},
"metrics": {
"UP_PUBLIC": {
"unit": "bps",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 43212393
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 12342929
}
]
},
"DOWN_PUBLIC": {
"unit": "bps",
"values": [
{
"timestamp": "2016-10-20T09:00:00Z",
"value": 202499
},
{
"timestamp": "2016-10-20T10:00:00Z",
"value": 29900
}
]
}
}
}
GETBandwidth metrics
This endpoint exposes bandwidth information for the given resource. Based on
the granularity query string parameter either a single value or multiple
values are returned.
Note that at this moment only bandwidth information for the public interface is supported.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| from | 2016-01-01T00:00:00Z | Start of date interval in ISO-8601 format The returned data will include everything up from - and including - the specified date time. |
| to | 2016-01-02T00:00:00Z | End of date interval in ISO-8601 format. The returned data will include everything up until - but not including - the specified date time. |
| granularity | Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: 5MIN,HOUR,DAY,WEEK,MONTH,YEAR) | |
| aggregation | Aggregate each metric using the given aggregation function. When the aggregation type `95TH` is specified the granularity parameter should be omitted from the request. (Allowed values: AVG,95TH) |
GEThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddosREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddos \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddos",
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", "/bareMetals/v2/privateRacks/12345/notificationSettings/ddos", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddos")
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
{
"nulling": "ENABLED",
"scrubbing": "DISABLED"
}
GETGet DDoS Notification Settings
On success the response will be an object with the current DDoS notification setting for this resource.
Notifications will be sent to all technical contact email addresses of the customer.
PUThttps://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddosREQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddos \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"scrubbing": "ENABLED",
"nulling": "DISABLED"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "{ \"scrubbing\": \"ENABLED\", \"nulling\": \"DISABLED\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"scrubbing\": \"ENABLED\", \"nulling\": \"DISABLED\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/privateRacks/12345/notificationSettings/ddos", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateRacks/12345/notificationSettings/ddos")
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"] = 'application/json'
request.body = "{ \"scrubbing\": \"ENABLED\", \"nulling\": \"DISABLED\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
If the new settings are stored successfully, a 204 No Content is returned.
PUTManage DDoS notifications Settings
To configure DDoS notification for this resource, send a PUT request. On
success the response will be a HTTP 204 No Content.
Notifications will be sent to all technical contact email addresses of the customer.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| scrubbing | string | true | Enable or disable email notifications for nulling events (Allowed values: ENABLED,DISABLED) |
| nulling | string | true | Enable or disable email notifications for nulling events (Allowed values: ENABLED,DISABLED) |
Remote Management API
This API can be used to to manage access to the Remote Management network
POSThttps://api.leaseweb.com/bareMetals/v2/remoteManagement/changeCredentialsREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/remoteManagement/changeCredentials \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"password": "mys3cretp@ssw0rd"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/remoteManagement/changeCredentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"password\": \"mys3cretp@ssw0rd\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"password\": \"mys3cretp@ssw0rd\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/remoteManagement/changeCredentials", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/remoteManagement/changeCredentials")
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"] = 'application/json'
request.body = "{ \"password\": \"mys3cretp@ssw0rd\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
The password is changed succesfully and will take effect immediatly.
POSTChange OpenVPN credentials
Users can change their OpenVPN credentials. These credentials are stored using one way encryption so the user is responsible for storing and/or remembering this password.
If the password is lost a new one can be generated using this API call. If a new password is generated it will replace the old password.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| password | string | true | The new password for OpenVPN authentication |
GEThttps://api.leaseweb.com/bareMetals/v2/remoteManagement/profilesREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles",
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", "/bareMetals/v2/remoteManagement/profiles", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles")
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": {
"limit": 10,
"offset": 0,
"totalCount": 1
},
"profiles": [
{
"datacenter": "AMS-01",
"file": "https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles/lsw-rmvpn-AMS-01.ovpn"
}
]
}
GETAll OpenVPN profiles
Retrieve a list of available OpenVPN profiles per data center.
These profiles are used to establish a OpenVPN connection to a data center which will give you access to the IPMI interface of your dedicated server. Access to this interface allows a user to remotely administer the server in case it is not reachable.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| profiles | array | An array of OpenVPN profiles available for download |
| datacenter | string | The datacenter code this profile is for |
| file | string | The location where this OpenVPN profile can be downloaded |
GEThttps://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles/lsw-rmvpn-AMS-01.ovpnREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles/lsw-rmvpn-AMS-01.ovpn \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles/lsw-rmvpn-AMS-01.ovpn",
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", "/bareMetals/v2/remoteManagement/profiles/lsw-rmvpn-AMS-01.ovpn", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/remoteManagement/profiles/lsw-rmvpn-AMS-01.ovpn")
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
GETSingle OpenVPN profile
Retrieve a OpenVPN profile for the given data center.
On success the response will be a pop specific OpenVPN profile containing a certificate and configuration.
This file can be used with OpenVPN clients to initiate a connection to Leaseweb Remote Management network.
Private Networking API
This API can be used to manage your private networks
GEThttps://api.leaseweb.com/bareMetals/v2/privateNetworksREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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": 4,
"id": "811",
"name": "default",
"createdAt": "2015-07-16T13:06:45+0200",
"updatedAt": "2015-07-16T13:06:45+0200"
}
]
}
GETList Private Networks
This lists all the Private Networks you have.
Currently only one Private Network is allowed per customer.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| privateNetworks | array | An array of private networks |
| id | string | The identifier of the private network |
| name | string | The name of the private network |
| serverCount | integer | Number of servers in this private network |
| createdAt | date | Date timestamp when the resource was created |
| updatedAt | date | Date timestamp when the resource was last updated |
POSThttps://api.leaseweb.com/bareMetals/v2/privateNetworksREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"name": "production"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"name\": \"production\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"name\": \"production\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/privateNetworks", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/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'
request["content-type"] = 'application/json'
request.body = "{ \"name\": \"production\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"id": "12345",
"name": "default",
"createdAt": "2015-01-21T14:34:12+0000",
"updatedAt": "2015-01-21T14:34:12+0000",
"servers": []
}
POSTCreate Private Network
Create a new Private Network.
Currently only one Private Network is allowed per customer.
Optionally you can give your Private Network a name by supplying the name
parameter in the request.
Once a Private Network is created you can add dedicated servers to this private network.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | false | A name to describe this private network |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| id | string | The identifier of the private network |
| name | string | The name of the private network |
| createdAt | date | Date timestamp when the resource was created |
| updatedAt | date | Date timestamp when the resource was last updated |
| servers | array | Array of servers connected to this private network |
| id | string | The identifier of the server |
| createdAt | date | Date timestamp when the server was added to the private network |
| updatedAt | date | Date timestamp when the server was last updated |
| CIDR | string | The private network ip address in CIDR notation assigned to the server |
| broadcast | string | The broadcast address of the server |
| dataCenter | string | The location of the server |
| gateway | string | The gateway of the server |
| netmask | string | The netmask of the server |
| portSpeed | string | The port speed of the server |
| status | string | The current status of your server in the private network |
| vlanId | string | The vlan tag for the server |
GEThttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/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", "/bareMetals/v2/privateNetworks/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/bareMetals/v2/privateNetworks/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
{
"id": "12345",
"name": "default",
"createdAt": "2015-01-21T14:34:12+0000",
"updatedAt": "2015-01-21T14:34:12+0000",
"servers": [
{
"CIDR": "10.30.0.224/27",
"broadcast": "10.30.0.255",
"createdAt": "2015-06-05T11:57:18+0000",
"dataCenter": "FRA-10",
"gateway": "10.30.0.254",
"id": "123940",
"netmask": "255.255.255.224",
"portSpeed": 100,
"status": "CONFIGURED",
"updatedAt": "2016-10-20T12:52:19+0000",
"vlanId": "2007"
}
]
}
GETGet Private Network
Show the details of a single Private Network.
This will also show all the dedicated servers which are currently part of this Private Network.
Every dedicated server in your private network contains a status key
explaining the current state of your server in your private network.
Possible state values are:
CONFIGURINGYour server is currently being added to the private network (can take ~5 minute)REMOVINGYour server is currently being removed from the private network (can take ~5 minute)CONFIGUREDYour server is part of the private network.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| id | string | The identifier of the private network |
| name | string | The name of the private network |
| createdAt | date | Date timestamp when the resource was created |
| updatedAt | date | Date timestamp when the resource was last updated |
| servers | array | Array of servers connected to this private network |
| id | string | The identifier of the server |
| createdAt | date | Date timestamp when the server was added to the private network |
| updatedAt | date | Date timestamp when the server was last updated |
| CIDR | string | The private network ip address in CIDR notation assigned to the server |
| broadcast | string | The broadcast address of the server |
| dataCenter | string | The location of the server |
| gateway | string | The gateway of the server |
| netmask | string | The netmask of the server |
| portSpeed | string | The port speed of the server |
| status | string | The current status of your server in the private network |
| vlanId | string | The vlan tag for the server |
PUThttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"name": "production"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/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 => "{ \"name\": \"production\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"name\": \"production\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("PUT", "/bareMetals/v2/privateNetworks/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/bareMetals/v2/privateNetworks/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"] = 'application/json'
request.body = "{ \"name\": \"production\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"id": "12345",
"name": "default",
"createdAt": "2015-01-21T14:34:12+0000",
"updatedAt": "2015-01-21T14:34:12+0000",
"servers": [
{
"CIDR": "10.30.0.224/27",
"broadcast": "10.30.0.255",
"createdAt": "2015-06-05T11:57:18+0000",
"dataCenter": "FRA-10",
"gateway": "10.30.0.254",
"id": "123940",
"netmask": "255.255.255.224",
"portSpeed": 100,
"status": "CONFIGURED",
"updatedAt": "2016-10-20T12:52:19+0000",
"vlanId": "2007"
}
]
}
PUTChange Private Network
Change the name of your private network
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | false | A name to describe this private network |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| id | string | The identifier of the private network |
| name | string | The name of the private network |
| createdAt | date | Date timestamp when the resource was created |
| updatedAt | date | Date timestamp when the resource was last updated |
| servers | array | Array of servers connected to this private network |
| id | string | The identifier of the server |
| createdAt | date | Date timestamp when the server was added to the private network |
| updatedAt | date | Date timestamp when the server was last updated |
| CIDR | string | The private network ip address in CIDR notation assigned to the server |
| broadcast | string | The broadcast address of the server |
| dataCenter | string | The location of the server |
| gateway | string | The gateway of the server |
| netmask | string | The netmask of the server |
| portSpeed | string | The port speed of the server |
| status | string | The current status of your server in the private network |
| vlanId | string | The vlan tag for the server |
DELETEhttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345REQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/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", "/bareMetals/v2/privateNetworks/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/bareMetals/v2/privateNetworks/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
A 204 will be returned if your private network was deleted.
DELETEDelete Private Network
This API call allows you to remove a private network.
Be aware that you can only delete a private network if it has no servers attached to it anymore.
POSThttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/serversREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"id": "29382832"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"id\": \"29382832\"}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"id\": \"29382832\"}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/privateNetworks/12345/servers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers")
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"] = 'application/json'
request.body = "{ \"id\": \"29382832\"}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
Your request has been accepted and your server will be added shortly
POSTAdd Server to Private Network
It takes a few minutes before the server has access to the private network.
To get the current status of the server you can call
/bareMetals/v2/privateNetworks/{id}.
Once the server is added to the private network the status changes from
CONFIGURING to CONFIGURED.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | true | The id of the server to add to the private network |
DELETEhttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678REQUEST EXAMPLE
curl --request DELETE \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678",
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", "/bareMetals/v2/privateNetworks/12345/servers/45678", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678")
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
A 202 will be returned if your server is scheduled to be removed from the private network.
DELETERemove Server from Private Network
Remove a server form the Private Network.
On success the server will be removed from the Private Network and the response status will be a 202 with no body returned.
It takes a few minutes before the server is actually removed. You can track the
status by making an API call to /bareMetals/v2/privateNetworks/{id}.
GEThttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeedREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed",
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", "/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed")
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
{
"portSpeed": 100
}
GETGet Port Speed of Server
Get the current port speed of the server in the private network.
On success, the response will show the current port speed for the server in this private network.
POSThttps://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeedREQUEST EXAMPLE
curl --request POST \
--url https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
--header 'content-type: application/json' \
--data '{
"portSpeed": 100
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"portSpeed\": 100}",
CURLOPT_HTTPHEADER => array(
"X-Lsw-Auth: 213423-2134234-234234-23424",
"content-type: application/json"
),
));
$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 = "{ \"portSpeed\": 100}"
headers = {
'X-Lsw-Auth': "213423-2134234-234234-23424",
'content-type': "application/json"
}
conn.request("POST", "/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/privateNetworks/12345/servers/45678/portSpeed")
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"] = 'application/json'
request.body = "{ \"portSpeed\": 100}"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
A 202 will be returned if your port speed change has been scheduled.
POSTUpdate Port Speed of Server
Set the current port speed of the server in the private network.
On success, HTTP status of 202 Accepted will be returned
It will take a minute before the port speed is changed. During this time the
status of the server changes to CONFIGURING.
The following properties should be part of the request:
| Name | Type | Required | Description |
|---|---|---|---|
| portSpeed | integer | true | The port speed to set for the server (Allowed values: 100,1000) |
Control Panels API
When reinstalling dedicated servers control panels can be installed. Use this API to find out which control panels are available
GEThttps://api.leaseweb.com/bareMetals/v2/controlPanelsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/controlPanels \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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
{
"_metadata": {
"totalCount": 2,
"limit": 10,
"offset": 0
},
"controlPanels": [
{
"id": "CPANEL_10",
"name": "cPanel 10"
},
{
"id": "PLESK_9",
"name": "Plesk 9"
}
]
}
GETControl Panels
Retrieve a list of control panels that are available for installation.
An id of a control panel can be supplied when (re)installing a dedicated
server (for more information on how to install dedicated servers via the API
refer to the API documentation).
Note that not all operating system support all control panels. Some operating
systems do not allow for installation of a control panel. To filter the list of
control panels which are supported for an operating system use the
operatingSystemId query string parameter to filter this list.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
| operatingSystemId | DEBIAN_9_64BIT | Filter control panels by operating system id |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| controlPanels | array | A list of control panels |
| id | string | The unique ID of this control panel |
| name | string | A human readable name describing the control panel |
Operating Systems API
This API can be used to determine which operating systems are available for installation on dedicated servers
GEThttps://api.leaseweb.com/bareMetals/v2/operatingSystemsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/operatingSystems \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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
{
"_metadata": {
"totalCount": 4,
"limit": 10,
"offset": 0
},
"operatingSystems": [
{
"id": "CENTOS_5.5_X86_64",
"name": "CentOS 5.5 (x86_64)"
},
{
"id": "DEBIAN_5.0_X86",
"name": "Debian 5.0 (x86)"
},
{
"id": "UBUNTU_8.04_AMD64",
"name": "Ubuntu 8.04 (amd64)"
},
{
"id": "WINDOWS_2008_ENTERPRISE_X86",
"name": "Windows 2008 Enterprise (x86)"
}
]
}
GETList Operating Systems
Retrieve a list of operating systems that are available for installation.
An id of a operating system can be supplied when (re)installing a dedicated
server (for more information on how to install dedicated servers via the API
refer to the API documentation).
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
| controlPanelId | PLESK_9 | Filter operating systems by control panel id |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| operatingSystems | array | A list of operating systems |
| id | string | The unique ID of this operating system |
| name | string | A human readable name describing the operating system |
GEThttps://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64 \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64",
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", "/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64")
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": "FREEBSD_11_1_64BIT",
"name": "FreeBSD 11.1 (amd64)",
"type": "unix",
"family": "freebsd",
"version": "11.1",
"architecture": "64bit",
"configurable": true,
"defaults": {
"device": "",
"partitions": [
{
"filesystem": "ufs",
"mountpoint": "/",
"primary": true,
"size": 1024
},
{
"filesystem": "swap",
"size": 4096
},
{
"filesystem": "ufs",
"mountpoint": "/var",
"size": 8192
},
{
"filesystem": "ufs",
"mountpoint": "/tmp",
"size": 2048
},
{
"filesystem": "ufs",
"mountpoint": "/usr",
"size": "*"
}
]
}
}
GETGet Operating System
Get more detailed information about a particular operating system.
This detailed information shows default options when installing the given operating system on a dedicated server.
For some operating systems these defaults can be adjusted when making the
POST request to /install. If the configurable parameter is true these
defaults can be adjusted by the client.
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| id | string | The operating system ID |
| name | string | A human readable name for the operating system |
| type | string | The type of operating system |
| family | string | The operating system family |
| version | string | The version of the operating system |
| architecture | string | The architecture of the operating system |
| configurable | boolean | If the default options are configurable or not |
| defaults | object | An object containing defaults for this operating system |
GEThttps://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64/controlPanelsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64/controlPanels \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64/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", "/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64/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/bareMetals/v2/operatingSystems/CENTOS_5_5_X86_64/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
{
"_metadata": {
"totalCount": 2,
"limit": 10,
"offset": 0
},
"controlPanels": [
{
"id": "CPANEL_10",
"name": "cPanel 10"
},
{
"id": "PLESK_9",
"name": "Plesk 9"
}
]
}
GETControl Panels for Operating System
Lists all the control panels that are supported for installation on the given operating system.
An id of a control panel can be supplied when (re)installing a dedicated
server (for more information on how to install dedicated servers via the API
refer to the API documentation).
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| controlPanels | array | A list of control panels |
| id | string | The unique ID of this control panel |
| name | string | A human readable name describing the control panel |
Rescue Images API
This API can be used to determine which rescue images are available for rescue mode
GEThttps://api.leaseweb.com/bareMetals/v2/rescueImagesREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/bareMetals/v2/rescueImages \
--header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/bareMetals/v2/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", "/bareMetals/v2/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/bareMetals/v2/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
{
"_metadata": {
"totalCount": 2,
"limit": 10,
"offset": 0
},
"rescueImages": [
{
"id": "RESCUE_3_64",
"name": "Rescue 3 (64)"
},
{
"id": "FREEBSD_2_64",
"name": "FreeBSD 2 (64)"
}
]
}
GETRescue Images
Lists all Rescue Images which are available for launching a dedicated server into rescue mode.
A rescueImageId can be supplied to the POST /rescueMode API call and will
reboot your server into rescue mode.
Launching rescue mode for a server is often used to troubleshoot an existing installation.
Note that launching rescue mode does not modify any data on the disks of your server. It will require your server to be rebooted.
The following query string parameters are available:
| Name | Example | Description |
|---|---|---|
| limit | 10 | Limit the number of results returned |
| offset | 10 | Return results starting from the given offset |
The following properties describe the response:
| Name | Type | Description |
|---|---|---|
| _metadata | object | Metadata about the collection |
| limit | integer | The maximum number of results returned |
| offset | integer | Results are returned started at the given offset |
| totalCount | integer | The total amount of results |
| rescueImages | array | A list of operating systems |
| id | string | The unique ID of this rescue image |
| name | string | A human readable name describing the rescue image |