November 23, 2017


# Retrieves the user data for the VSIs in the account.
# The script gets the user metadata for a VSI in the account we make a simple
# call the getVirtualGuests() in the SoftLayer_Virtual_Guest API service
# and we set an object mask to get the information about the user data.
# Important manual pages
# see
# see
# License <>
# author SoftLayer Technologies, Inc. <>
require 'softlayer_api'
require 'pp'

# Your SoftLayer API username and key.
USERNAME = 'set me'
APIKEY = 'set me'

# Adding the object mask to the call to get the information about the user data.
object_mask = 'mask[userData]'

# Declaring the API client
client = USERNAME, api_key: APIKEY)
account_service = client['SoftLayer_Account']

  # Retrieving our account's VSIs records.
  servers = account_service.object_mask(object_mask).getVirtualGuests
  print servers
rescue StandardError => exception
  puts "Unable to retrieve the VSI list. : #{exception}"


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