February 12, 2014


Place quote order

Retrieve an order object from a quote and place an order based on it
import SoftLayer
from pprint import pprint as pp
 
quote_id = 12345

client = SoftLayer.Client()

def getOrderContainer(quote_id):
    container = client['Billing_Order_Quote'].getRecalculatedOrderContainer(id=quote_id)
    return container['orderContainers'][0]
 
def getQuotes():
    quotes = client['SoftLayer_Account'].getActiveQuotes()
    pp(quotes)

getQuotes()
guests = {'hostname': 'quotetest', 'domain': 'example.com'}
container = getOrderContainer(quote_id)
container['quantity'] = 1
container['virtualGuests'] = []
# You will need to add a hostname and domain entry for each server on the order
# if quantity was 5, you would need to add 5 guests here
container['virtualGuests'].append(guests)
container['presetId'] = None
result = client['Billing_Order_Quote'].verifyOrder(container, id=quote_id)

pp(result)

Feedback?

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