April 25, 2018


Get snapshot space available

The script makes a single call to SoftLayer_Account::getNetworkStorage
method to get the network storages into the account and uses a mask
in order to get the snapshot space available.

See below for more details

Important manual pages:

License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
import SoftLayer

Your SoftLayer API username and key.

Generate an API key at the SoftLayer Customer Portal:
API_KEY = 'apikey_goes_here'

# Declare a new API service object
client = SoftLayer.Client(username=USERNAME,api_key=API_KEY)
accountService = client['Account']

# Setting the object mask to get the snapshot space available value.
storageMask = "id, capacityGb, username, snapshotSpaceAvailable, vendorName"

    storageUnits = accountService.getNetworkStorage(mask=storageMask)
    print (storageUnits)
except SoftLayer.SoftLayerAPIError as e:
    If there was an error returned from the SoftLayer API then bomb out with the
    error message.
    print("Unable to retrieve the bare metal list. "
          % (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