create_customer.py
create_customer.py
'''
Create a customer.
Important manual pages
http://sldn.softlayer.com/reference/services/SoftLayer_Brand/createCustomerAccount
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Account
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <[email protected]>
'''
import SoftLayer.API
import json
USERNAME = 'set me'
API_KEY = 'set me'
template = {
'address1': '8200 Warden Ave',
'city': 'Markham',
'companyName': 'My company',
'email': '[email protected]',
'firstName': 'FirstName',
'lastName': 'Surename',
'officePhone': 'number',
'postalCode': 'L6G 1C7',
'state': 'TX',
'brandId': 4,
'country': 'CA'
}
client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY)
brandService = client['SoftLayer_Brand']
try:
result = brandService.createCustomerAccount(template)
print(json.dumps(result, sort_keys=True, indent=2, separators=(',', ': ')))
except SoftLayer.SoftLayerAPIError as e:
print("Unable to create the customer. "
% (e.faultCode, e.faultString))