Bare Metal (v2)

The base URL for this API is: https://api.leaseweb.com/bareMetals/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 networks

List private networks

Authorizations:
query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/bareMetals/v2/privateNetworks?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "privateNetworks": [
    ]
}

Create a 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.

Authorizations:
Request Body schema: application/json
name
string

A name to describe this private network

Responses

Request samples

Content type
application/json
{
  • "name": "production"
}

Response samples

Content type
application/json
{
  • "id": "12345",
  • "name": "default",
  • "createdAt": "2015-01-21T14:34:12+0000",
  • "updatedAt": "2015-01-21T14:34:12+0000",
  • "equipmentCount": 0,
  • "servers": [ ]
}

Inspect a 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:

  • CONFIGURING Your server is currently being added to the private network (can take ~5 minute)
  • REMOVING Your server is currently being removed from the private network (can take ~5 minute)
  • CONFIGURED Your server is part of the private network.
Authorizations:
path Parameters
privateNetworkId
required
string

Id of the privateNetwork

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/%7BprivateNetworkId%7D \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "id": "12345",
  • "name": "default",
  • "createdAt": "2015-01-21T14:34:12+0000",
  • "updatedAt": "2015-01-21T14:34:12+0000"
}

Update a private network

Authorizations:
path Parameters
privateNetworkId
required
string

Id of the privateNetwork

Request Body schema: application/json
name
string

A name to describe this private network

Responses

Request samples

Content type
application/json
{
  • "name": "production"
}

Response samples

Content type
application/json
{
  • "id": "12345",
  • "name": "default",
  • "createdAt": "2015-01-21T14:34:12+0000",
  • "updatedAt": "2015-01-21T14:34:12+0000",
  • "servers": [ ]
}

Delete a private network

You can only delete a private network if it has no equipments attached to it anymore.

Authorizations:
path Parameters
privateNetworkId
required
string

Id of the privateNetwork

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/%7BprivateNetworkId%7D \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "36ddff0b-0fc5-4bc5-cb4f-4a16a3895204",
  • "errorCode": 400,
  • "errorMessage": "You can only delete a private network if all equipments are removed from it."
}

Get DHCP reservations

Use this API to get DHCP the reservations of a private network.

Authorizations:
path Parameters
privateNetworkId
required
string
Example: 892

The ID of a Private Network

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/892/reservations \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "reservations": [
    ]
}

Create a DHCP reservation

Create a DHCP reservation for a private network.

Authorizations:
path Parameters
privateNetworkId
required
string
Example: 892

The ID of a Private Network

Request Body schema: application/json
ip
required
string

The IP address for this DHCP reservation

mac
required
string

The Mac address for this DHCP reservation

sticky
required
boolean

If false, this DHCP reservation will be automatically removed if not used for a longer period

Responses