November 23, 2017

Retrieve the billing items  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 items and items 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.create_client_from_env(username=USERNAME, api_key=API_KEY)
accountService = client['SoftLayer_Account']

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

    # Retrieve the bare metal servers billing items 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