Private Clouds API v2

Private Clouds

The Private Clouds endpoints provide you the ability to retrieve information about the Private Clouds that you have at LeaseWeb. This resource gives you control over each private cloud.

GEThttps://api.leaseweb.com/cloud/v2/privateClouds
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds",
  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", "/cloud/v2/privateClouds", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/cloud/v2/privateClouds")

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
200 OK
{
  "privateClouds": [
    {
      "id": "218030",
      "customerId": "1301178860",
      "dataCenter": "AMS-01",
      "serviceOffering": "FLAT_FEE",
      "sla": "Bronze",
      "contract": {
        "id": "30000775",
        "startsAt": "2015-11-01T00:00:00+02:00",
        "endsAt": "2016-12-30T10:39:27+01:00",
        "billingCycle": 12,
        "billingFrequency": "MONTH",
        "pricePerFrequency": 0,
        "currency": "EUR"
      },
      "hardware": {
        "cpu": {
          "cores": 25
        },
        "memory": {
          "unit": "GB",
          "amount": 50
        },
        "storage": {
          "unit": "GB",
          "amount": 1
        }
      },
      "ips": [
        {
          "ip": "10.12.144.32",
          "version": 4,
          "type": "PUBLIC"
        },
        {
          "ip": "10.12.144.33",
          "version": 4,
          "type": "PUBLIC"
        }
      ],
      "networkTraffic": {
        "type": "DATATRAFFIC",
        "trafficType": "PREMIUM|VOLUME",
        "datatrafficUnit": "TB",
        "datatrafficLimit": 6
      }
    },
    {
      "id": "218031",
      "customerId": "1301178860",
      "dataCenter": "AMS-01",
      "serviceOffering": "FLAT_FEE",
      "sla": "Bronze",
      "contract": {
        "id": "30000775",
        "startsAt": "2015-11-01T00:00:00+02:00",
        "endsAt": "2016-12-30T10:39:27+01:00",
        "billingCycle": 12,
        "billingFrequency": "MONTH",
        "pricePerFrequency": 0,
        "currency": "EUR"
      },
      "hardware": {
        "cpu": {
          "cores": 10
        },
        "memory": {
          "unit": "GB",
          "amount": 30
        },
        "storage": {
          "unit": "TB",
          "amount": 1
        }
      },
      "ips": [
        {
          "ip": "10.12.144.63",
          "version": 4,
          "type": "PUBLIC"
        },
        {
          "ip": "10.12.144.64",
          "version": 4,
          "type": "PUBLIC"
        }
      ],
      "networkTraffic": {
        "type": "DATATRAFFIC",
        "trafficType": "PREMIUM|VOLUME",
        "datatrafficUnit": "TB",
        "datatrafficLimit": 6
      }
    }
  ],
  "_metadata": {
    "totalCount": 2,
    "offset": 0,
    "limit": 10
  }
}

GETList your Private Clouds

To retrieve a list of all of your private clouds, send a GET request to /cloud/v2/privateClouds.

The following query parameters are available:

Name Type Required Description Example
limit integer No Maximum amount of private clouds to be retrieved, for pagination purposes. 10
offset integer No Result offset, for pagination purposes. 0

The response will be a JSON object with following keys:

Name Type Description
privateClouds object Array of your private clouds.
_metadata object Metadata of the request, containing the total number of private clouds in the collection, the limit and the offset.

The privateClouds object consists of array of privateCloud having the following attributes:

Name Type Description
id string Identifier of the private cloud resource.
customerId string Your customer identifier.
dataCenter string Data center code where the Private cloud is located.
serviceOffering string Private cloud service offering. This value will be either FLAT_FEE or ON_DEMAND.
sla string Service Level Agreement of your Private cloud.
contract object Private cloud contract information.
hardware object Private cloud hardware information.
ips object Information about the private cloud's IP address(es).
networkTraffic object Network traffic associated to the Private cloud.

The contract object contains the following attributes:

Name Type Description
id string Private cloud contract identifier.
startsAt date Contractual date for the private cloud.
endsAt date Contractual end date for the private cloud.
billingCycle integer Applied billing cycle.
billingFrequency string Applied billing frequency.
currency string Currency of the contract according to ISO-4217.

The hardware object contains the following attributes:

Name Type Description
cpu object CPU information.
memory object Memory information.
storage object Storage information.

The cpu object contains the following attributes:

Name Type Description
cores integer Number of cores that the virtual server has.

The memory object contains the following attributes:

Name Type Description
unit string Unit in which the amount attribute is measured.
amount integer Amount of memory that the virtual server has.

The storage object contains the following attributes:

Name Type Description
unit string Unit in which the amount attribute is measured.
amount integer Amount of storage that the virtual server has.

The ips object consists of array of ip objects having the following attributes:

Name Type Description
ip string IP address
version integer IP address version. Possible values are: 4, 6.
type string IP type. Possible values are: PUBLIC, PRIVATE.

The networkTraffic object contains the following attributes:

Name Type Description
type string Type of network traffic. Possible values are: DATATRAFFIC.
trafficType string Type of traffic. Possible values are: VOLUME, PREMIUM.
datatrafficUnit string Unit in which the data traffic limit is represented.
datatrafficLimit integer Data traffic limit for the private cloud.

The _metadata object contains the following attributes:

Name Type Description
totalCount integer Total amount of private clouds that were found.
limit integer Maximum amount of private clouds that will be included in the privateClouds array.
offset integer Offset of the request.

The following query string parameters are available:

Name Example Description
limit about limits
offset offset
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030 \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds/218030",
  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", "/cloud/v2/privateClouds/218030", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/cloud/v2/privateClouds/218030")

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
200 OK
{
  "id": "218030",
  "customerId": "1301178860",
  "dataCenter": "AMS-01",
  "serviceOffering": "FLAT_FEE",
  "sla": "Bronze",
  "contract": {
    "id": "30000775",
    "startsAt": "2015-11-01T00:00:00+02:00",
    "endsAt": "2016-12-30T10:39:27+01:00",
    "billingCycle": 12,
    "billingFrequency": "MONTH",
    "pricePerFrequency": 0,
    "currency": "EUR"
  },
  "hardware": {
    "cpu": {
      "cores": 25
    },
    "memory": {
      "unit": "GB",
      "amount": 50
    },
    "storage": {
      "unit": "GB",
      "amount": 1
    }
  },
  "ips": [
    {
      "ip": "10.12.144.32",
      "version": 4,
      "type": "PUBLIC"
    },
    {
      "ip": "10.12.144.33",
      "version": 4,
      "type": "PUBLIC"
    }
  ],
  "networkTraffic": {
    "type": "DATATRAFFIC",
    "trafficType": "PREMIUM|VOLUME",
    "datatrafficUnit": "TB",
    "datatrafficLimit": 6
  }
}

GETRetrieve a Private Cloud

To get information about a specific private cloud, send a GET request to /cloud/v2/privateClouds.

Name Type Description
id string Identifier of the private cloud resource.
customerId string Your customer identifier.
dataCenter string Data center code where the Private cloud is located.
serviceOffering string Private cloud service offering. This value will be either FLAT_FEE or ON_DEMAND.
sla string Service Level Agreement of your Private cloud.
contract object Private cloud contract information.
hardware object Private cloud hardware information.
ips object Information about the private cloud's IP address(es).
networkTraffic object Network traffic associated to the Private cloud.

The contract object contains the following attributes:

Name Type Description
id string Private cloud contract identifier.
startsAt date Contractual date for the private cloud.
endsAt date Contractual end date for the private cloud.
billingCycle integer Applied billing cycle.
billingFrequency string Applied billing frequency.
currency string Currency of the contract according to ISO-4217.

The hardware object contains the following attributes:

Name Type Description
cpu object CPU information.
memory object Memory information.
storage object Storage information.

The cpu object contains the following attributes:

Name Type Description
cores integer Number of cores that the virtual server has.

The memory object contains the following attributes:

Name Type Description
unit string Unit in which the amount attribute is measured.
amount integer Amount of memory that the virtual server has.

The storage object contains the following attributes:

Name Type Description
unit string Unit in which the amount attribute is measured.
amount integer Amount of storage that the virtual server has.

The ips object consists of array of ip objects having the following attributes:

Name Type Description
ip string IP address
version integer IP address version. Possible values are: 4, 6.
type string IP type. Possible values are: PUBLIC, PRIVATE.

The networkTraffic object contains the following attributes:

Name Type Description
type string Type of network traffic. Possible values are: DATATRAFFIC.
trafficType string Type of traffic. Possible values are: VOLUME, PREMIUM.
datatrafficUnit string Unit in which the data traffic limit is represented.
datatrafficLimit integer Data traffic limit for the private cloud.
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT",
  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", "/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT")

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
200 OK
{
  "credentials": [
    {
      "type": "REMOTE_MANAGEMENT",
      "username": "root",
      "domain": "123456"
    }
  ],
  "_metadata": {
    "totalCount": 1,
    "offset": 0,
    "limit": 10
  }
}

GETList the credentials

To retrieve a list of all of your credentials, send a GET request to /cloud/v2/privateClouds/{id}/credentials/{credentialType}. Please note that you will only be able to retrieve the last password that we configured in your remote management tool. If you changed it, the information retrieved by this API call will not work.

The following table explains the possible values that must be used in the URL parameters:

Name Type Description
credentialType string Type of credential pair. Possible values are REMOTE_MANAGEMENT.

The following query parameters are available:

Name Type Required Description Example
limit integer No Maximum amount of credentials to be retrieved, for pagination purposes. 10
offset integer No Result offset, for pagination purposes. 0

The response will be a JSON object with following keys:

Name Type Description
credentials object Array of your credentials.
_metadata object Metadata of the request, containing the total number of credentials in the collection, the limit and the offset.

The credentials object consists of array of credentials having the following attributes:

Name Type Description
type string Type of credential pair. Possible values are REMOTE_MANAGEMENT.
username string Name of the user in the remote management tool.
domain string Domain name to log in to the remote management tool.

Please note that the password is not returned in this call, you must use the endpoint to get a credential by the username to retrieve it.

The _metadata object contains the following attributes:

Name Type Description
totalCount integer Total amount of credentials that were found.
limit integer Maximum amount of credentials that will be included in the credentials array.
offset integer Offset of the request.
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT/root
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT/root \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT/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", "/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT/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/cloud/v2/privateClouds/218030/credentials/REMOTE_MANAGEMENT/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
200 OK
{
  "type": "REMOTE_MANAGEMENT",
  "username": "root",
  "password": "password123",
  "domain": "123456"
}

GETGet the credentials of a user

To get information about a specific credentials, send a GET request to /cloud/v2/privateClouds/{id}/credentials/{credentialType}/{username}. Please note that you will only be able to retrieve the last password that we configured in your server or control panel. If you changed it, the information retrieved by this API call will not work.

Name Type Description
type string Type of credential pair. Possible values are REMOTE_MANAGEMENT.
username string Name of the user in the remote management tool.
domain string Domain name to log in to the remote management tool.
password string Password associated to the username.
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/datatraffic
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030/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/cloud/v2/privateClouds/218030/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", "/cloud/v2/privateClouds/218030/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/cloud/v2/privateClouds/218030/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
200 OK
{
  "_metadata": {
    "from": "2017-07-01T00:00:00+00:00",
    "to": "2017-07-01T00:00:00+00:00",
    "granularity": "MONTH",
    "aggregation": "SUM"
  },
  "metrics": {
    "DATATRAFFIC_UP": {
      "unit": "GB",
      "values": [
        {
          "timestamp": "2017-07-01T00:00:00+00:00",
          "value": 900
        },
        {
          "timestamp": "2017-07-02T00:00:00+00:00",
          "value": 2500
        }
      ]
    },
    "DATATRAFFIC_DOWN": {
      "unit": "GB",
      "values": [
        {
          "timestamp": "2017-07-01T00:00:00+00:00",
          "value": 90
        },
        {
          "timestamp": "2017-07-02T00:00:00+00:00",
          "value": 250
        }
      ]
    }
  }
}

GETGet the datatraffic metrics

To retrieve a list of all of your datatraffic metrics, send a GET request to /cloud/v2/privateClouds/{id}/metrics/datatraffic.

The following query parameters are available:

Name Type Required Description
granularity string No Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Yes Aggregation method of the returned values. Possible values are: SUM.
from date Yes Start of date interval in RFC3339 format.
to date Yes End of date interval in RFC3339 format.

The response will be a JSON object with following keys:

Name Type Description
metrics object Array of your datatraffic metrics.
_metadata object Metadata of the request.

The metrics object consists of array of metric having the following attributes:

Name Type Description
DATATRAFFIC_UP object Outgoing datatraffic metrics.
DATATRAFFIC_DOWN object Incoming datatraffic metrics.

The DATATRAFFIC_UP object contains the following attributes:

Name Type Description
unit string Unit in which the metric is measured.
values object Array of value objects that contains the metric measurements.

The DATATRAFFIC_DOWN object contains the following attributes:

Name Type Description
unit string Unit in which the metric is measured.
values object Array of value objects that contains the metric measurements.

The value object contains the following attributes:

Name Type Description
timestamp date Date where the metric was measured.
value object Metric value.

The _metadata object contains the following attributes:

Name Type Description
from date Start date (inclusive) in format RFC3339.
to date End timestamp (exclusive) in format RFC3339.
granularity string Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Aggregation method of the returned values. Possible values are: SUM.

The following query string parameters are available:

Name Example Description
granularity Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: NONE,5MIN,HOUR,DAY,MONTH,YEAR)
aggregation Aggregate each metric using the given aggregation function. (Allowed values: SUM)
from 2016-01-01T00:00:00+00:00 Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time.
to 2016-01-02T00:00:00+00:00 End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time.
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/cpu
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/cpu \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/cpu",
  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", "/cloud/v2/privateClouds/218030/metrics/cpu", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/cpu")

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
200 OK
{
  "_metadata": {
    "from": "2017-07-01T00:00:00+00:00",
    "to": "2017-07-02T00:00:00+00:00",
    "granularity": "MONTH",
    "aggregation": "MAX"
  },
  "metrics": {
    "CPU": {
      "unit": "CORES",
      "values": [
        {
          "timestamp": "2017-07-01T00:00:00+00:00",
          "value": 24
        },
        {
          "timestamp": "2017-07-02T00:00:00+00:00",
          "value": 24
        }
      ]
    }
  }
}

GETGet the CPU metrics

To retrieve a list of all of your cpu metrics, send a GET request to /cloud/v2/privateClouds/{id}/metrics/cpu.

The following query parameters are available:

Name Type Required Description
granularity string No Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Yes Aggregation method of the returned values. Possible values are: AVG.
from date Yes Start of date interval in RFC3339 format.
to date Yes End of date interval in RFC3339 format.

The response will be a JSON object with following keys:

Name Type Description
metrics object Array of your cpu metrics.
_metadata object Metadata of the request.

The metrics object consists of array of metric having the following attributes:

Name Type Description
CPU object CPU metrics.

The CPU object contains the following attributes:

Name Type Description
unit string Unit in which the metric is measured.
values object Array of value objects that contains the metric measurements.

The value object contains the following attributes:

Name Type Description
timestamp date Date where the metric was measured.
value object Metric value.

The _metadata object contains the following attributes:

Name Type Description
from date Start date (inclusive) in format RFC3339.
to date End timestamp (exclusive) in format RFC3339.
granularity string Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Aggregation method of the returned values. Possible values are: AVG.

The following query string parameters are available:

Name Example Description
granularity Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: NONE,5MIN,HOUR,DAY,MONTH,YEAR)
aggregation Aggregate each metric using the given aggregation function. (Allowed values: AVG,MIN,MAX)
from 2016-01-01T00:00:00+00:00 Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time.
to 2016-01-02T00:00:00+00:00 End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time.
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/memory
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/memory \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/memory",
  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", "/cloud/v2/privateClouds/218030/metrics/memory", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/memory")

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
200 OK
{
  "_metadata": {
    "from": "2017-07-01T00:00:00+00:00",
    "to": "2017-07-02T00:00:00+00:00",
    "granularity": "MONTH",
    "aggregation": "MAX"
  },
  "metrics": {
    "MEMORY": {
      "unit": "GB",
      "values": [
        {
          "timestamp": "2017-07-01T00:00:00+00:00",
          "value": 8
        },
        {
          "timestamp": "2017-07-02T00:00:00+00:00",
          "value": 16
        }
      ]
    }
  }
}

GETGet the memory metrics

To retrieve a list of all of your memory metrics, send a GET request to /cloud/v2/privateClouds/{id}/metrics/memory.

The following query parameters are available:

Name Type Required Description
granularity string No Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Yes Aggregation method of the returned values. Possible values are: AVG.
from date Yes Start of date interval in RFC3339 format.
to date Yes End of date interval in RFC3339 format.

The response will be a JSON object with following keys:

Name Type Description
metrics object Array of your memory metrics.
_metadata object Metadata of the request.

The metrics object consists of array of metric having the following attributes:

Name Type Description
MEMORY object Outgoing datatraffic metrics.

The MEMORY object contains the following attributes:

Name Type Description
unit string Unit in which the metric is measured.
values object Array of value objects that contains the metric measurements.

The value object contains the following attributes:

Name Type Description
timestamp date Date where the metric was measured.
value object Metric value.

The _metadata object contains the following attributes:

Name Type Description
from date Start date (inclusive) in format RFC3339.
to date End timestamp (exclusive) in format RFC3339.
granularity string Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Aggregation method of the returned values. Possible values are: AVG.

The following query string parameters are available:

Name Example Description
granularity Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: NONE,5MIN,HOUR,DAY,MONTH,YEAR)
aggregation Aggregate each metric using the given aggregation function. (Allowed values: AVG,MIN,MAX)
from 2016-01-01T00:00:00+00:00 Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time.
to 2016-01-02T00:00:00+00:00 End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time.
GEThttps://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/storage
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/storage \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/storage",
  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", "/cloud/v2/privateClouds/218030/metrics/storage", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/cloud/v2/privateClouds/218030/metrics/storage")

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
200 OK
{
  "_metadata": {
    "from": "2017-07-01T00:00:00+00:00",
    "to": "2017-07-02T00:00:00+00:00",
    "granularity": "MONTH",
    "aggregation": "MAX"
  },
  "metrics": {
    "STORAGE": {
      "unit": "GB",
      "values": [
        {
          "timestamp": "2017-07-01T00:00:00+00:00",
          "value": 900
        },
        {
          "timestamp": "2017-07-02T00:00:00+00:00",
          "value": 2500
        }
      ]
    }
  }
}

GETGet the storage metrics

To retrieve a list of all of your storage metrics, send a GET request to /cloud/v2/privateClouds/{id}/metrics/storage.

The following query parameters are available:

Name Type Required Description
granularity string No Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Yes Aggregation method of the returned values. Possible values are: MAX.
from date Yes Start of date interval in RFC3339 format.
to date Yes End of date interval in RFC3339 format.

The response will be a JSON object with following keys:

Name Type Description
metrics object Array of your storage metrics.
_metadata object Metadata of the request.

The metrics object consists of array of metric having the following attributes:

Name Type Description
STORAGE object Storage metrics.

The STORAGE object contains the following attributes:

Name Type Description
unit string Unit in which the metric is measured.
values object Array of value objects that contains the metric measurements.

The value object contains the following attributes:

Name Type Description
timestamp date Date where the metric was measured.
value object Metric value.

The _metadata object contains the following attributes:

Name Type Description
from date Start date (inclusive) in format RFC3339.
to date End timestamp (exclusive) in format RFC3339.
granularity string Granularity of the request. Possible values are: NONE, 5MIN, HOUR, DAY, MONTH, YEAR.
aggregation string Aggregation method of the returned values. Possible values are: MAX.

The following query string parameters are available:

Name Example Description
granularity Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. (Allowed values: NONE,5MIN,HOUR,DAY,MONTH,YEAR)
aggregation Aggregate each metric using the given aggregation function. (Allowed values: AVG,MIN,MAX)
from 2016-01-01T00:00:00+00:00 Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time.
to 2016-01-02T00:00:00+00:00 End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time.