November 23, 2017

Set tags for a VSI

The script sets the tags for an arbitrary VSI,
it makes a single call to the SoftLayer_Virtual_Guest::setTags method
For more information please see below.

Important manual pages:

Author: SoftLayer Technologies, Inc. <>
import SoftLayer.API
from pprint import pprint as pp

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

# Declare the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
virtualGuestService = client['SoftLayer_Virtual_Guest']

# The virtual guestID you wish to get the tags
virtualGuestId = 7844984

# The list of tags you wish to set to the VSI
tags = "mytag1,mytag2,mytag3"

# Send the request to get the tags
    result = virtualGuestService.setTags(tags, id=virtualGuestId)
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to set the tags faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))


We would love to hear it
Open an issue