November 23, 2017


# DNS Zone Details.
# It retrieves the SoftLayer_Dns_Domain object whose ID number corresponds to
# the ID number of the init parameter passed to the SoftLayer_Dns_Domain service.
# Important manual pages:
# see
# license <>
# author SoftLayer Technologies, Inc. <>

require 'rubygems'
require 'softlayer_api'

# Set the domain id that you want to get details.
dns_id = 1846857

# Your SoftLayer API username.
SL_API_USERNAME = 'set me'

# Your SoftLayer API key.
SL_API_KEY = 'set me'

softlayer_client = SL_API_USERNAME,
                                         api_key: SL_API_KEY)

domain_service = softlayer_client.service_named('Dns_Domain')
domain_ref = domain_service.object_with_id(dns_id)

# You can use getObject method to get details too (but there is less information than getResourceRecords)
# result = domain_ref.getObject

# Create a mask to get specific data
mask_string = 'mask[id,name,resourceRecords]'

  result = domain_ref.object_mask(mask_string).getObject
  puts 'The DNS Zone details display successfully'
  puts result.inspect

rescue StandardError => e
  puts 'Error when executing the script...'



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