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

200
401

Authentication is required.

403
500
503
get/privateNetworks
https://api.leaseweb.com/bareMetals/v2/privateNetworks

Request samples

Copy
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
Copy
Expand all Collapse all
{
  • "_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

201
401

Authentication is required.

403
500
503
post/privateNetworks
https://api.leaseweb.com/bareMetals/v2/privateNetworks

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "name": "production"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "12345",
  • "name": "default",
  • "createdAt": "2015-01-21T14:34:12+0000",
  • "updatedAt": "2015-01-21T14:34:12+0000",
  • "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

200
401

Authentication is required.

403
404
500
503
get/privateNetworks/{privateNetworkId}
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}

Request samples

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

Response samples

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

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

200
400

The errorDetails value is an object describing why validation failed.

401

Authentication is required.

403
404
500
503
put/privateNetworks/{privateNetworkId}
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "name": "production"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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 servers attached to it anymore.

Authorizations:
path Parameters
privateNetworkId
required
string

Id of the privateNetwork

Responses

204

A 204 will be returned if your private network was deleted.

400
401

Authentication is required.

403
404
500
503
delete/privateNetworks/{privateNetworkId}
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}

Request samples

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

Response samples

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

Add server

It takes a few minutes before the server has access to the private network.

To get the current status of the server you can call /bareMetals/v2/privateNetworks/{id}.

Once the server is added to the private network the status changes from CONFIGURING to CONFIGURED.

Authorizations:
path Parameters
privateNetworkId
required
string

Id of the privateNetwork

Request Body schema: application/json
id
required
string

The id of the server to add to the private network

Responses

202

Your request has been accepted and your server will be added shortly

400

The errorDetails value is an object describing why validation failed.

401

Authentication is required.

403
404
500
503
post/privateNetworks/{privateNetworkId}/servers
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}/servers

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "29382832"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "correlationId": "945bef2e-1caf-4027-bd0a-8976848f3dee",
  • "errorCode": 400,
  • "errorDetails": { },
  • "errorMessage": "Validation Failed"
}

Remove server

Authorizations:
path Parameters
serverId
required
string

Id of the server

privateNetworkId
required
string

Id of the privateNetwork

Responses

202

A 202 will be returned if your server is scheduled to be removed from the private network.

401

Authentication is required.

403
404
500
503
delete/privateNetworks/{privateNetworkId}/servers/{serverId}
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}/servers/{serverId}

Request samples

Copy
curl --request DELETE \
  --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/%7BprivateNetworkId%7D/servers/%7BserverId%7D \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "errorCode": "ACCESS_DENIED",
  • "errorMessage": "The access token is expired or invalid."
}

Inspect port speed of server

Authorizations:
path Parameters
serverId
required
string

Id of the server

privateNetworkId
required
string

Id of the privateNetwork

Responses

200
401

Authentication is required.

403
404
500
503
get/privateNetworks/{privateNetworkId}/servers/{serverId}/portSpeed
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}/servers/{serverId}/portSpeed

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/%7BprivateNetworkId%7D/servers/%7BserverId%7D/portSpeed \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "portSpeed": 100
}

Update port speed of server

It might take a minute before the port speed is changed. During this time the status of the server changes to CONFIGURING.

Authorizations:
path Parameters
serverId
required
string

Id of the server

privateNetworkId
required
string

Id of the privateNetwork

Request Body schema: application/json
portSpeed
required
integer
Enum: 100 1000

The port speed to set for the server

Responses

202

A 202 will be returned if your port speed change has been scheduled.

400

The errorDetails value is an object describing why validation failed.

401

Authentication is required.

403
404
500
503
post/privateNetworks/{privateNetworkId}/servers/{serverId}/portSpeed
https://api.leaseweb.com/bareMetals/v2/privateNetworks/{privateNetworkId}/servers/{serverId}/portSpeed

Request samples