The base URL for this API is: https://api.leaseweb.com/cloud/v2/
The API uses standard HTTP status codes to indicate the success or failure of the API call. The response will be JSON. Most APIs use the following format:
{
"errorCode" : "APP00800",
"errorMessage" : "The connection with the DB cannot be established.",
"correlationId" : "550e8400-e29b-41d4-a716-446655440000",
"userMessage" : "Cannot handle your request at the moment. Please try again later.",
"reference" : "http://developer.leaseweb.com/errors/APP00800"
}
Authentication for the APIs is required. To authenticate your call, you will need to sent your API key as X-LSW-Auth
header.
You can generate API keys in the Customer Portal.
limit | integer Default: 10 Example: limit=10 Limit the number of results returned |
offset | integer Default: 0 Return results starting from the given offset |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "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
}
}
privateCloudId required | string Example: 123242 Id of the private cloud |
curl --request GET \ --url https://api.leaseweb.com/cloud/v2/privateClouds/123242 \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "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
}
}
Please note that this feature is only available for CloudStack Private Clouds.
Also 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.
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. |
credentialType required | string Value: "REMOTE_MANAGEMENT" Type of credential pair |
privateCloudId required | string Example: 123242 Id of the private cloud |
limit | integer Default: 10 Example: limit=10 Limit the number of results returned |
offset | integer Default: 0 Return results starting from the given offset |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds/123242/credentials/%7BcredentialType%7D?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "credentials": [
- {
- "type": "REMOTE_MANAGEMENT",
- "username": "root",
- "domain": "123456"
}
], - "_metadata": {
- "totalCount": 1,
- "offset": 0,
- "limit": 10
}
}
Please note that this feature is only available for CloudStack Private Clouds.
Also 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.
credentialType required | string Value: "REMOTE_MANAGEMENT" Type of credential pair |
username required | string Name of the user in the remote management tool |
privateCloudId required | string Example: 123242 Id of the private cloud |
curl --request GET \ --url https://api.leaseweb.com/cloud/v2/privateClouds/123242/credentials/%7BcredentialType%7D/%7Busername%7D \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "type": "REMOTE_MANAGEMENT",
- "username": "root",
- "password": "password123",
- "domain": "123456"
}
privateCloudId required | string Example: 123242 Id of the private cloud |
granularity | string Enum: "NONE" "5MIN" "HOUR" "DAY" "MONTH" "YEAR" Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. |
aggregation | string Value: "SUM" Aggregate each metric using the given aggregation function. |
from | date Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time. |
to | date End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time. |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds/%7B[privateCloudId%7D/metrics/datatraffic?granularity=SOME_STRING_VALUE&aggregation=SOME_STRING_VALUE&from=SOME_DATE_VALUE&to=SOME_DATE_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_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
}
]
}
}
}
privateCloudId required | string Example: 123242 Id of the private cloud |
granularity | string Enum: "NONE" "5MIN" "HOUR" "DAY" "MONTH" "YEAR" Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. |
aggregation | string Value: "AVG" Aggregate each metric using the given aggregation function. |
from | date Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time. |
to | date End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time. |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds/123242/metrics/bandwidth?granularity=SOME_STRING_VALUE&aggregation=SOME_STRING_VALUE&from=SOME_DATE_VALUE&to=SOME_DATE_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_metadata": {
- "from": "2017-07-01T00:00:00+00:00",
- "to": "2017-08-01T00:00:00+00:00",
- "granularity": "MONTH",
- "aggregation": "AVG"
}, - "metrics": {
- "DOWN_PUBLIC": {
- "unit": "bps",
- "values": [
- {
- "timestamp": "2017-07-01T00:00:00+00:00",
- "value": 28202557
}
]
}, - "UP_PUBLIC": {
- "unit": "bps",
- "values": [
- {
- "timestamp": "2017-07-01T00:00:00+00:00",
- "value": 158317519
}
]
}
}
}
privateCloudId required | string |
granularity | string Enum: "NONE" "5MIN" "HOUR" "DAY" "MONTH" "YEAR" Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. |
aggregation | string Value: "AVG" Aggregate each metric using the given aggregation function. |
from | date Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time. |
to | date End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time. |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds/%7BprivateCloudId%7D/metrics/cpu?granularity=SOME_STRING_VALUE&aggregation=SOME_STRING_VALUE&from=SOME_DATE_VALUE&to=SOME_DATE_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_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
}
]
}
}
}
privateCloudId required | string Example: 123242 Id of the private cloud |
granularity | string Enum: "NONE" "5MIN" "HOUR" "DAY" "MONTH" "YEAR" Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. |
aggregation | string Value: "AVG" Aggregate each metric using the given aggregation function. |
from | date Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time. |
to | date End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time. |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds/123242/metrics/memory?granularity=SOME_STRING_VALUE&aggregation=SOME_STRING_VALUE&from=SOME_DATE_VALUE&to=SOME_DATE_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_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
}
]
}
}
}
privateCloudId required | string Example: 123242 Id of the private cloud |
granularity | string Enum: "NONE" "5MIN" "HOUR" "DAY" "MONTH" "YEAR" Specify the preferred interval for each metric. If granularity is omitted from the request, only one metric is returned. |
aggregation | string Value: "MAX" Aggregate each metric using the given aggregation function. |
from | date Start of date interval in RFC3339 format. The returned data will include everything up from - and including - the specified date time. |
to | date End of date interval in RFC3339 format. The returned data will include everything up until - but not including - the specified date time. |
curl --request GET \ --url 'https://api.leaseweb.com/cloud/v2/privateClouds/123242/metrics/storage?granularity=SOME_STRING_VALUE&aggregation=SOME_STRING_VALUE&from=SOME_DATE_VALUE&to=SOME_DATE_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_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
}
]
}
}
}