Dedicated Network Equipment API (v2)

This is the description of the Dedicated Network Equipment API.

The base url of this API is https://api.leaseweb.com.

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" : "https://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.

Getting Started

List network equipment

List your Dedicated Network Equipment. This api call supports pagination. Use the limit and offset query string parameters to paginate through all your dedicated network equipment.

Every network equipment object in the json response lists a few properties of a network equipment. Use the single resource api call to get more details for a single network equipment.

Authorizations:
Leaseweb API Key Auth
query Parameters
limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

reference
string
Example: reference=my-switch

Filter the list of network equipment by reference.

ip
string <ipv4>
Example: ip=127.0.0.4

Filter the list of network equipment by ip address.

macAddress
string([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9...
Example: macAddress=aa:bb:cc:dd:ee:ff

Filter the list of network equipment by mac address.

site
string
Example: site=FRA-10

Filter the list of network equipment by site (location).

privateRackId
string
Example: privateRackId=123

Filter the list of network equipment by dedicated rack id.

privateNetworkCapable
string
Enum: "true" "false"

Filter the list for private network capable network equipment

privateNetworkEnabled
string
Enum: "true" "false"

Filter the list for private network enabled network equipment

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/bareMetals/v2/networkEquipments?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&reference=SOME_STRING_VALUE&ip=SOME_STRING_VALUE&macAddress=00%3A15%3A17%3ADB%3A63%3A01&site=SOME_STRING_VALUE&privateRackId=SOME_STRING_VALUE&privateNetworkCapable=SOME_STRING_VALUE&privateNetworkEnabled=SOME_STRING_VALUE' \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

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

Get network equipment

Use this API to get information about a single network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345 \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "contract": {
    },
  • "featureAvailability": {
    },
  • "id": "12345",
  • "location": {
    },
  • "name": "ABC-DE-001",
  • "networkInterfaces": {
    },
  • "powerPorts": [
    ],
  • "rack": {
    },
  • "serialNumber": "XN51FPD0QX",
  • "specs": {
    },
  • "type": "SWITCH"
}

Update network equipment

Update the reference for a network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Request Body schema: application/json
required
reference
required
string

The reference for this network equipment

Responses

Request samples

Content type
application/json
{
  • "reference": "my-private-switch"
}

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "401",
  • "errorMessage": "You are not authorized to view this resource."
}

IPs

List IPs

List all IP Addresses associated with this network equipment. Optionally filtered.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

query Parameters
networkType
string
Enum: "INTERNAL" "PUBLIC" "REMOTE_MANAGEMENT"
Example: networkType=INTERNAL

Filter the collection of ip addresses by network type

version
string

Filter the collection by ip version

nullRouted
string

Filter Ips by Nulled-Status

ips
string

Filter the collection of Ips for the comma separated list of Ips

limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/ips?networkType=INTERNAL&version=SOME_STRING_VALUE&nullRouted=SOME_STRING_VALUE&ips=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

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

Show a network equipment IP

Get a single IP address associated with this network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

ip
required
string
Example: 127.0.0.6

The IP Address

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/ips/127.0.0.6 \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ddos": {
    },
  • "floatingIp": false,
  • "gateway": "12.123.123.254",
  • "ip": "12.123.123.1/24",
  • "mainIp": true,
  • "networkType": "PUBLIC",
  • "nullRouted": false,
  • "reverseLookup": "domain.example.com",
  • "version": 4
}

Update an IP

Update the reverse lookup or DDoS detection profile for the ip address.

DDoS detection profiles can only be changed if the IP address is protected using Advanced DDoS protection.

For more information about DDoS detection profiles click here for our KB related article.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

ip
required
string
Example: 127.0.0.6

The IP Address

Request Body schema: application/json
detectionProfile
string
Enum: "ADVANCED_DEFAULT" "ADVANCED_LOW_UDP" "ADVANCED_MED_UDP"

The detection profile value

reverseLookup
string

The reverse lookup value

Responses

Request samples

Content type
application/json
{
  • "detectionProfile": "ADVANCED_LOW_UDP",
  • "reverseLookup": "domain.example.com"
}

Response samples

Content type
application/json
{
  • "ddos": {
    },
  • "floatingIp": false,
  • "gateway": "12.123.123.254",
  • "ip": "12.123.123.1/24",
  • "mainIp": true,
  • "networkType": "PUBLIC",
  • "nullRouted": false,
  • "reverseLookup": "domain.example.com",
  • "version": 4
}

Null route an IP

Null the given IP address. It might take a few minutes before the change is propagated across the network.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

ip
required
string
Example: 127.0.0.6

The IP Address

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/ips/127.0.0.6/null \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ddos": {
    },
  • "floatingIp": false,
  • "gateway": "12.123.123.254",
  • "ip": "12.123.123.1/24",
  • "mainIp": true,
  • "networkType": "PUBLIC",
  • "nullRouted": false,
  • "reverseLookup": "domain.example.com",
  • "version": 4
}

Remove a null route

Remove an existing null route for the given IP address. It might take a few minutes before the change is propagated across the network.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

ip
required
string
Example: 127.0.0.6

The IP Address

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/ips/127.0.0.6/unnull \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ddos": {
    },
  • "floatingIp": false,
  • "gateway": "12.123.123.254",
  • "ip": "12.123.123.1/24",
  • "mainIp": true,
  • "networkType": "PUBLIC",
  • "nullRouted": false,
  • "reverseLookup": "domain.example.com",
  • "version": 4
}

Show null route history

Show all null route history for any ips associated with this a network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

query Parameters
limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/nullRouteHistory?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

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

Credentials

List network equipment credentials

The credentials API allows you to store usernames and passwords securely.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

query Parameters
limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/credentials?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

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

Create new network equipment credentials

Password will NOT be updated on the network equipment. The ability to update credentials is for convenience only. It provides a secure way to communicate passwords with Leaseweb engineers in case support is required.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Request Body schema: application/json
password
required
string

The password for the credentials

type
required
string (credentialType)

Enum: OPERATING_SYSTEM, CONTROL_PANEL, REMOTE_MANAGEMENT, RESCUE_MODE, SWITCH, PDU, FIREWALL, LOAD_BALANCER

The type of the credential.

username
required
string

The username for the credentials

Responses

Request samples

Content type
application/json
{
  • "password": "mys3cr3tp@ssw0rd",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Response samples

Content type
application/json
{
  • "password": "mys3cr3tp@ssw0rd",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

List network equipment credentials by type

List all the credentials filtered by the specified type that are associated with this network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

type
required
string
Example: OPERATING_SYSTEM

Credential type

query Parameters
limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/credentials/%7Btype%7D?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

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

Delete network equipment credentials

This action is purely administrative and will only remove the username and password associated with this resource from our database.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

type
required
string
Example: OPERATING_SYSTEM

Credential type

username
required
string
Example: root

Username

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/credentials/%7Btype%7D/%7Busername%7D \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "401",
  • "errorMessage": "You are not authorized to view this resource."
}

Show network equipment credentials

View the password for the given credential, identified by type and username.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

type
required
string
Example: OPERATING_SYSTEM

Credential type

username
required
string
Example: root

Username

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/credentials/%7Btype%7D/%7Busername%7D \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "password": "mys3cr3tp@ssw0rd",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Update network equipment credentials

The usernames or types cannot be changed. In order to change those remove this credentials and create a new one.

This action is purely administrative and will only update the password associated with this resource in our database.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

type
required
string
Example: OPERATING_SYSTEM

Credential type

username
required
string
Example: root

Username

Request Body schema: application/json
password
required
string

The password for the credentials

Responses

Request samples

Content type
application/json
{
  • "password": "mys3cr3tp@ssw0rd"
}

Response samples

Content type
application/json
{
  • "password": "mys3cr3tp@ssw0rd",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Power

Power cycle a network equipment

Powercyle the network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/powerCycle \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Show power status

The network equipment can either be ON or OFF. Network Equipment can be powered on or off by using the respective /powerOn and /powerOff API calls. In addition network equipment can also be rebooted using the /powerCycle API call.

The pdu object describes the power status from the power distribution unit (PDU) point of view. If your network equipment is connected to multiple PDU ports the status property will report on if at least one PDU port has power.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/powerInfo \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "pdu": {
    }
}

Power off network equipment

Power off the given network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/powerOff \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Power on network equipment

Power on the given network equipment.

Authorizations:
Leaseweb API Key Auth
path Parameters
networkEquipmentId
required
string
Example: 12345

The ID of a dedicated network equipment

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/bareMetals/v2/networkEquipments/12345/powerOn \
  --header 'X-Lsw-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}