IP Management API v1 Deprecated
IPs
The IP resources are IPs connected to one of your bare metal server or cloud instances. You can manage your IPs via this resource (change the reverse lookup for example).
GEThttps://api.leaseweb.com/v1/ipsREQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/ips \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/ips",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("GET", "/v1/ips", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/ips")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ips": [
{
"ip": {
"ip": "1.2.3.4",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"billingInformation": {
"price": "1.00",
"startDate": "Mar 1, 2010",
"endDate": null
},
"serverId": "12345",
"serverType": "Bare Metal",
"serverName": "TEST SERVER",
"ipDetails": {
"gateway": "1.2.3.254",
"mask": "255.255.255.0"
}
}
},
{
"ip": {
"ip": "1.2.3.5",
"reverseLookup": "test.leaseweb.com",
"ipDetails": {
"gateway": "1.2.3.254",
"mask": "255.255.255.0"
},
"nullRouted": false,
"billingInformation": {
"price": "0.00",
"startDate": "Apr 1, 2015",
"endDate": null
},
"serverId": "12346",
"serverType": "Bare Metal",
"serverName": "TEST SERVER2"
}
}
]
}
GETGet all your IPs
To retrieve a list of all of your IPs, send a GET request to /v1/ips.
The response will be a JSON object with key ips containing an array of your IPs, each of which contain the standard IP attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | The IP |
| reverseLookup | string | The reverse lookup set for the IP |
| nullRouted | boolean | Boolean to indicate if the IP is null-routed |
| serverId | integer | Identifier of the server using the IP |
| serverType | string | The type of server using the IP (Bare Metal, Cloud,...) |
| serverName | string | Name assigned to the server |
| ipDetails | object | Object containing information about netmask and gateway |
| billingInformation | object | Object containing information about billing |
The ipDetails object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| gateway | string | The gateway to be used for the IP resource |
| netmask | string | The reverse lookup set for the IP resource |
The billingInformation object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| price | string | Monthly price for the IP resource |
| startDate | string | The start date for the IP resource |
| endDate | string | The end date of the IP resource |
You can use the following query filters:
| Name | Type | Description |
|---|---|---|
| nullRouted | boolean | Flag to filter by nullrouted IP (0=false, 1=true) |
GEThttps://api.leaseweb.com/v1/ips/85.17.96.111REQUEST EXAMPLE
curl --request GET \
--url https://api.leaseweb.com/v1/ips/85.17.96.111 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/ips/85.17.96.111",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
headers = { 'X-LSW-Auth': "213423-2134234-234234-23424" }
conn.request("GET", "/v1/ips/85.17.96.111", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/ips/85.17.96.111")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ip": {
"ip": "1.2.3.4",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"billingInformation": {
"price": "1.00",
"startDate": "Mar 1, 2010",
"endDate": null
},
"serverId": "12345",
"serverType": "Bare Metal",
"serverName": "TEST SERVER",
"ipDetails": {
"gateway": "1.2.3.254",
"mask": "255.255.255.0"
}
}
}
GETGet a single IP
To retrieve a single IP resource, send a GET request to /v1/ips/{ipAddress}.
The response will be a JSON object with key ip containing the standard IP attributes:
| Name | Type | Description |
|---|---|---|
| ip | string | The IP |
| reverseLookup | string | The reverse lookup set for the IP |
| nullRouted | boolean | Boolean to indicate if the IP is null-routed |
| serverId | integer | Identifier of the server using the IP |
| serverType | string | The type of server using the IP (Bare Metal, Cloud,...) |
| serverName | string | Name assigned to the server |
| ipDetails | object | Object containing information about netmask and gateway |
| billingInformation | object | Object containing information about billing |
The ipDetails object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| gateway | string | The gateway to be used for the IP resource |
| netmask | string | The reverse lookup set for the IP resource |
The billingInformation object contains the following attributes:
| Name | Type | Description |
|---|---|---|
| price | string | Monthly price for the IP resource |
| startDate | string | The start date for the IP resource |
| endDate | string | The end date of the IP resource |
PUThttps://api.leaseweb.com/v1/ips/85.17.96.111REQUEST EXAMPLE
curl --request PUT \
--url https://api.leaseweb.com/v1/ips/85.17.96.111 \
--header 'X-LSW-Auth: 213423-2134234-234234-23424' \
--header 'content-type: x-www-form-urlencoded' \
--data reverseLookup=my-reverse.hostname.com \
--data nullRouted=0
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.leaseweb.com/v1/ips/85.17.96.111",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "reverseLookup=my-reverse.hostname.com&nullRouted=0",
CURLOPT_HTTPHEADER => array(
"X-LSW-Auth: 213423-2134234-234234-23424",
"content-type: x-www-form-urlencoded"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("api.leaseweb.com")
payload = "reverseLookup=my-reverse.hostname.com&nullRouted=0"
headers = {
'X-LSW-Auth': "213423-2134234-234234-23424",
'content-type': "x-www-form-urlencoded"
}
conn.request("PUT", "/v1/ips/85.17.96.111", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.leaseweb.com/v1/ips/85.17.96.111")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["X-LSW-Auth"] = '213423-2134234-234234-23424'
request["content-type"] = 'x-www-form-urlencoded'
request.body = "reverseLookup=my-reverse.hostname.com&nullRouted=0"
response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
{
"ip": {
"ip": "1.2.3.4",
"reverseLookup": "hosted-by.leaseweb.com",
"nullRouted": false,
"billingInformation": {
"price": "1.00",
"startDate": "Mar 1, 2010",
"endDate": null
},
"serverId": "12345",
"serverType": "Bare Metal",
"serverName": "TEST SERVER",
"ipDetails": {
"gateway": "1.2.3.254",
"mask": "255.255.255.0"
}
}
}
PUTUpdate a single IP
To update the reverse lookup or to nullroute an IP resource, send a PUT request to /v1/ips/{ipAddress}.
The request should contain one of the following form parameters:
| Name | Type | Description |
|---|---|---|
| reverseLookup | string | The reverse lookup for the IP resource |
| nullRouted | boolean | A boolean indicating whether the IP should be nullrouted (0=false, 1=true) |