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 an object mask to get the
# billing items and items for each Bare Metal server in the account.
# Important manual pages
# License:
# Author: SoftLayer Technologies, Inc. <>
use lib 'C:/softlayerApis/perl/softlayer-api-perl-client-master/';
use SoftLayer::API::SOAP;
use JSON;
use Data::Dumper;
use strict;

# Your SoftLayer API username and key.
my $api_username = 'set me';
my $api_key = 'set me';

# Declaring the service
my $account_service = SoftLayer::API::SOAP->new('SoftLayer_Account', undef, $api_username, $api_key);

# Declaring the object mask to get information about the items
my $object_mask = 'mask[id, hostname, domain, datacenter[longName], billingItem[item]]';

my $servers = $account_service->getHardware();

# If there was an error returned from the SoftLayer API then die out with the
# error message.
if ($servers->fault) {
    die "Unable to retrieve the bare metal servers." . $servers->faultstring;

print Dumper($servers->result);


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