Private Clouds API (v2)

The base URL for this API is: https://api.leaseweb.com/cloud/v2/

Errors

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

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.

Private clouds

List private clouds

Authorizations:
query Parameters
limit
integer
Default: 10
Example: limit=10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

Responses

200
401

Authentication is required.

403
500
503
get/privateClouds
https://api.leaseweb.com/cloud/v2/privateClouds

Request samples

Copy
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'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "privateClouds":
    [
    ],
  • "_metadata":
    {
    }
}

Inspect a private cloud

Authorizations:
path Parameters
privateCloudId
required
string
Example: 123242

Id of the private cloud

Responses

200
401

Authentication is required.

403
404
500
503
get/privateClouds/{privateCloudId}
https://api.leaseweb.com/cloud/v2/privateClouds/{privateCloudId}

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/123242 \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "218030",
  • "customerId": "1301178860",
  • "dataCenter": "AMS-01",
  • "serviceOffering": "FLAT_FEE",
  • "sla": "Bronze",
  • "contract":
    {
    },
  • "hardware":
    {
    },
  • "ips":
    [
    ],
  • "networkTraffic":
    {
    }
}

List credentials

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.
Authorizations:
path Parameters
credentialType
required
string
Value: "REMOTE_MANAGEMENT"

Type of credential pair

privateCloudId
required
string
Example: 123242

Id of the private cloud

query Parameters
limit
integer
Default: 10
Example: limit=10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

Responses

200
401

Authentication is required.

403
404
500
503
get/privateClouds/{privateCloudId}/credentials/{credentialType}
https://api.leaseweb.com/cloud/v2/privateClouds/{privateCloudId}/credentials/{credentialType}

Request samples

Copy
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'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "credentials":
    [
    ],
  • "_metadata":
    {
    }
}

Inspect user credentials

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.

Authorizations:
path Parameters
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

Responses

200
401

Authentication is required.

403
404
500
503
get/privateClouds/{privateCloudId}/credentials/{credentialType}/{username}
https://api.leaseweb.com/cloud/v2/privateClouds/{privateCloudId}/credentials/{credentialType}/{username}

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/privateClouds/123242/credentials/%7BcredentialType%7D/%7Busername%7D \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "type": "REMOTE_MANAGEMENT",
  • "username": "root",
  • "password": "password123",
  • "domain": "123456"
}

Inspect datatraffic metrics

Authorizations:
path Parameters
privateCloudId
required
string
Example: 123242

Id of the private cloud

query Parameters
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.

Responses

200
401

Authentication is required.

403
404
500
503
get/privateClouds/{[privateCloudId}/metrics/datatraffic
https://api.leaseweb.com/cloud/v2/privateClouds/{[privateCloudId}/metrics/datatraffic

Request samples

Copy
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'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "_metadata":
    {
    },
  • "metrics":
    {
    }
}

Inspect bandwidth metrics

Authorizations:
path Parameters
privateCloudId
required
string
Example: 123242

Id of the private cloud

query Parameters
granularity
string
Enum: "NONE" "5MIN" "HOUR" "DAY"