November 23, 2017

Set tags to a virtual server

The script set the tags for an arbitrary VSI
it makes a single call to the SoftLayer_Virtual_Guest::setTags
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 virtual guest ID where you wish to add the tags
virtualGuestID = 35747489

# the tags you wish to add
tags = "tag1,tag2,tag3"

client = SoftLayer.create_client_from_env(username=API_USERNAME, api_key=API_KEY)
virtualGuestService = client['SoftLayer_Virtual_Guest']

    result = virtualGuestService.setTags(tags, id=virtualGuestID)
    print (result)
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 set the tags"
          % (e.faultCode, e.faultString))


We would love to hear it
Open an issue