// Create a Map to store all the data of a Customer
Map<String, Object> nsCustomer = new Map<String, Object>();
nsCustomer.put('companyName', 'Grand Hotels & Resorts Ltd');
nsCustomer.put('category', new Map<String, Object>{'internalId'=>'5'});
nsCustomer.put('customForm', new Map<String, Object>{'internalId'=>'-2'});
nsCustomer.put('currencyRecord', new Map<String, Object>{'internalId'=>'1'});
nsCustomer.put('partner', new Map<String, Object>{'internalId'=>'9'});
nsCustomer.put('priceLevel', new Map<String, Object>{'internalId'=>'1'});
nsCustomer.put('receivablesAccount', new Map<String, Object>{'internalId'=>'122'});
nsCustomer.put('subsidiary', new Map<String, Object>{'internalId'=>'1'});
nsCustomer.put('startDate', DateTime.newInstance(2020, 12, 2).getTime()/1000);
nsCustomer.put('terms', new Map<String, Object>{'internalId'=>'5'});
nsCustomer.put('territory', new Map<String, Object>{'internalId'=>'-5'});
nsCustomer.put('url', 'https://www.grandhotel.com');
// Initiale the Customer Custom Fields
List<Object> custCustomFieldList = new List<Object>();
Map<String, Object> custCustomField1 = new Map<String, Object>();
custCustomField1.put('fieldType', 'select');
custCustomField1.put('scriptId', 'custentityrating');
custCustomField1.put('valueLookup', new Map<String, Object>{'internalId'=>'2'});
custCustomFieldList.add(custCustomField1);
Map<String, Object> custCustomField2 = new Map<String, Object>();
custCustomField2.put('fieldType', 'double');
custCustomField2.put('scriptId', 'custentity_decimal');
custCustomField2.put('value', '76.89');
custCustomFieldList.add(custCustomField2);
// Add the Customer Custom Fields
nsCustomer.put('customFieldList', new Map<String, Object>{'customField'=>custCustomFieldList});
// Initialize the Customer Addresses
Map<String, Object> addressbookAddress = new Map<String, Object>();
addressbookAddress.put('addr1','2334 N. Michigan Avenue, Suite 1500');
addressbookAddress.put('city','Chicago');
addressbookAddress.put('state','IL');
addressbookAddress.put('country','_unitedStates');
addressbookAddress.put('zip','60601');
Map<String, Object> addressBook = new Map<String, Object>();
addressBook.put('addressbookAddress',addressbookAddress);
addressBook.put('defaultBilling',true);
addressBook.put('defaultShipping',true);
addressBook.put('isResidential',true);
List<Object> addressBookList = new List<Object>();
addressBookList.add(addressBook);
nsCustomer.put('addressbookList', new Map<String,Object>{'addressbook'=>addressBookList});
// Initialize the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('customers', new List<Object>{nsCustomer});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'createCustomer');
reqObj.put('requestJSON', reqJSON);
// Place a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);