November 23, 2017
Order a Evault device.

Important manual pages:

Author: SoftLayer Technologies, Inc. <>

import SoftLayer
import json

USERNAME = 'set me'
API_KEY = 'set me'

# Values "AMS01", "AMS03", "CHE01", "DAL05", "DAL06" "FRA02", "HKG02", "LON02", etc.
location = "DAL05"

# Values "20", "30", "40", "50", "60", "100", etc.
size = "20"

# The VSI or Sever IP address where the Evault will be added.
ip = ""


client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
productOrderService = client['SoftLayer_Product_Order']
packageService = client['SoftLayer_Product_Package']
locationService = client['SoftLayer_Location']
serverService = client['SoftLayer_Hardware_Server']
vsiService = client['SoftLayer_Virtual_Guest']

objectFilterDatacenter = {"name": {"operation": location.lower()}}
objectMaskLocation = "mask[priceGroups]"

    # Getting the datacenter.
    datacenter = locationService.getDatacenters(filter=objectFilterDatacenter, mask=objectMaskLocation)
    objectFilterEvaultPrices = {}
    if len(datacenter[0]['priceGroups']) == 0:
        objectFilterEvaultPrices = {"itemPrices": {"item": {"capacity": {"operation": size}}, "categories": {"categoryCode": {"operation": "evault"}}, "locationGroupId": {"operation": "is null"}}}
        objectFilterEvaultPrices = {"itemPrices": {"item": {"capacity": {"operation": size}}, "categories": {"categoryCode": {"operation": "evault"}}, "locationGroupId": {"operation": datacenter[0]['priceGroups'][0]['id']}}}
    # Getting the Evault prices.
    prices = packageService.getItemPrices(id=PACKAGE_ID, filter=objectFilterEvaultPrices)
    # In case we get an empty list of prices the reason could be that there is no a specific price for the selected location so we try looking an standard price.
    if len(prices) == 0:
        objectFilterEvaultPrices = {"itemPrices": {"item": {"capacity": {"operation": size}}, "categories": {"categoryCode": {"operation": "evault"}}, "locationGroupId": {"operation": "is null"}}}
        prices = packageService.getItemPrices(id=PACKAGE_ID, filter=objectFilterEvaultPrices)
    # In case the list of prices is still empty that means that the configured size is invalid for an Evault.
    if len(prices) == 0:
        print("The configured size: " + size + " is not valid for an Evault device.")

    # Build the order template
    orderTemplate = {
        "complexType": "SoftLayer_Container_Product_Order_Network_Storage_Backup_Evault_Vault",
        "location": datacenter[0]['id'],
        "packageId": PACKAGE_ID,
        "prices": [
                "complexType": "SoftLayer_Product_Item_Price",
                "id": prices[0]['id']
        "quantity": 1
    # Getting the device id.
    # We look for the IP address in the servers.
    device = serverService.findByIpAddress(ip)
    if 'id' in device:
        # Adding the server id to the order template.
        orderTemplate['hardware'] = []
        hardware = {}
        hardware['id'] = device['id']
        # We look for the IP address in the VSIs.
        device = vsiService.findByIpAddress(ip)
        if 'id' not in device:
            print("The configured IP address: " + ip + " does not exist.")
        # Adding the VSI to the order
        orderTemplate['virtualGuests'] = []
        vsi = {}
        vsi['id'] = device['id']
    # verifyOrder() will check your order for errors. Replace this with a call to
    # placeOrder() when you're ready to order. Both calls return a receipt object
    # that you can use for your records.
    response = productOrderService.verifyOrder(orderTemplate)
    print(json.dumps(response, sort_keys=True, indent=2, separators=(',', ': ')))
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to place the order. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue