November 23, 2017

Retrieve the billing info for the Bare Metals in the account.

This script makes a single call to the getHardware() method in the
SoftLayer_Account API service and uses a object mask to get the
billing info for each Bare Metal server in the account.

Important manual pages

Author: SoftLayer Technologies, Inc. <>
import SoftLayer

Client configuration
Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'

# Declare the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
accountService = client['SoftLayer_Account']

# Declaring the object mask to get information about the billing item.
objectMask = "mask[id, hostname, domain, datacenter[longName], billingItem[recurringFee]]"

    # Retrieve the bare metal servers for the account.
    result = accountService.getHardware(mask=objectMask)
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to retrieve the servers. " % (e.faultCode, e.faultString))


We would love to hear it
Open an issue