Skip to content

Instantly share code, notes, and snippets.

@sudorandom
Forked from underscorephil/placeQuote.py
Created August 17, 2013 15:41
Show Gist options
  • Save sudorandom/6257486 to your computer and use it in GitHub Desktop.
Save sudorandom/6257486 to your computer and use it in GitHub Desktop.
# So we can talk to the SoftLayer API:
import SoftLayer.API
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
apiUsername =
apiKey =
quoteId =
orderClient = SoftLayer.API.Client('SoftLayer_Product_Order', None, apiUsername, apiKey)
def getOrderContainer(quoteId):
quoteClient = SoftLayer.API.Client('SoftLayer_Billing_Order_Quote', \
quoteId, apiUsername, apiKey)
quoteContainer = quoteClient.getRecalculatedOrderContainer()
return quoteContainer['orderContainers'][0]
orderContainer = getOrderContainer(quoteId)
orderContainer['complexType'] = 'SoftLayer_Container_Product_Order_Virtual_Guest'
orderContainer['virtualGuests'] = [{'hostname': 'server01', 'domain': 'example.com'}]
result = quoteClient.placeOrder(orderContainer)
pp(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment