November 23, 2017
Set user data for a Bare Metal Server.

The script makes a single call to the
SoftLayer_Hardware_Server::setUserMetadata method
in order to set the user data in the bare metal server.
For more information see below.

Important manual pages:

Author: SoftLayer Technologies, Inc. <>

import SoftLayer

# Your SoftLayer API username and key.
API_USERNAME = 'set-me'

# Generate one at
API_KEY = 'set-me'

# The id of the Bare Metal server you wish to set the user data.
baremetalId = 284776

# The user data you wish to set.
userData = ['my test']

# Declare a new API service object.
client = SoftLayer.create_client_from_env(username=API_USERNAME, api_key=API_KEY)
hardwareservice = client['SoftLayer_Hardware_Server']

    result = hardwareservice.setUserMetadata(userData, id=baremetalId)
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to set the user data: \nfaultCode= %s, \nfaultString= %s"
          % (e.faultCode, e.faultString))