The base URL for this API is: https://api.leaseweb.com/bareMetals/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 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/bareMetals/v2/privateNetworks?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_metadata": {
- "totalCount": 1,
- "limit": 10,
- "offset": 0
}, - "privateNetworks": [
- {
- "equipmentCount": 4,
- "id": "811",
- "name": "default",
- "createdAt": "2015-07-16T13:06:45+0200",
- "updatedAt": "2015-07-16T13:06:45+0200"
}
]
}
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.
name | string A name to describe this private network |
{- "name": "production"
}
{- "id": "12345",
- "name": "default",
- "createdAt": "2015-01-21T14:34:12+0000",
- "updatedAt": "2015-01-21T14:34:12+0000",
- "equipmentCount": 0,
- "servers": [ ]
}
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.privateNetworkId required | string Id of the privateNetwork |
curl --request GET \ --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/%7BprivateNetworkId%7D \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "id": "12345",
- "name": "default",
- "createdAt": "2015-01-21T14:34:12+0000",
- "updatedAt": "2015-01-21T14:34:12+0000"
}
privateNetworkId required | string Id of the privateNetwork |
name | string A name to describe this private network |
{- "name": "production"
}
{- "id": "12345",
- "name": "default",
- "createdAt": "2015-01-21T14:34:12+0000",
- "updatedAt": "2015-01-21T14:34:12+0000",
- "servers": [ ]
}
You can only delete a private network if it has no equipments attached to it anymore.
privateNetworkId required | string Id of the privateNetwork |
curl --request DELETE \ --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/%7BprivateNetworkId%7D \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "correlationId": "36ddff0b-0fc5-4bc5-cb4f-4a16a3895204",
- "errorCode": 400,
- "errorMessage": "You can only delete a private network if all equipments are removed from it."
}
Use this API to get DHCP the reservations of a private network.
privateNetworkId required | string Example: 892 The ID of a Private Network |
curl --request GET \ --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/892/reservations \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "_metadata": {
- "limit": 20,
- "offset": 0,
- "totalCount": 1
}, - "reservations": [
- {
- "ip": "127.0.0.1",
- "mac": "d8:87:03:52:0a:0f",
- "sticky": true
}
]
}
Create a DHCP reservation for a private network.
privateNetworkId required | string Example: 892 The ID of a Private Network |
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 |
{- "ip": "127.0.0.1",
- "mac": "D8:87:03:52:0A:0F",
- "sticky": true
}
{- "ip": "127.0.0.1",
- "mac": "d8:87:03:52:0a:0f",
- "sticky": true
}
This API call will delete a DHCP reservation from a private network.
privateNetworkId required | string Example: 892 The ID of a Private Network |
ip required | string Example: 127.0.0.6 The IP Address |
curl --request DELETE \ --url https://api.leaseweb.com/bareMetals/v2/privateNetworks/892/reservations/127.0.0.6 \ --header 'X-LSW-Auth: REPLACE_KEY_VALUE'
{- "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
- "errorCode": "400",
- "errorDetails": { },
- "errorMessage": "Validation Failed."
}