November 23, 2017

Classes SoftLayer_Account
Tags vlans
Example to get the VLANS in an account

The example retrieves a list of all VLANs in the account.
It makes a single call to the SoftLayer_Account::getPublicNetworkVlans
method. For more information please see below.

Important manual pages:

Author: SoftLayer Technologies, Inc. <>
import SoftLayer

# 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)

# Declaring an object mask to get more information about the VLANs
objectMask = "primaryRouter[datacenter], dedicatedFirewallFlag, firewallNetworkComponentCount, firewallGuestNetworkComponentCount, firewallInterfaces, highAvailabilityFirewallFlag, networkVlanFirewall"

    # Getting the VLANs
    result = client['SoftLayer_Account'].getPublicNetworkVlans(mask=objectMask)
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 get Vlans. 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