// Create a Map to store all the data of an Estimate
Map<String, Object> nsEstimate = new Map<String, Object>();
nsEstimate.put('classification', new Map<String, Object>{'internalId'=>'5'});
nsEstimate.put('currencyRecord', new Map<String, Object>{'internalId'=>'2'});
nsEstimate.put('customForm', new Map<String, Object>{'internalId'=>'124'});
nsEstimate.put('department', new Map<String, Object>{'internalId'=>'2'});
nsEstimate.put('discountItem', new Map<String, Object>{'internalId'=>'-6'});
nsEstimate.put('discountRate', '-15');
nsEstimate.put('dueDate', DateTime.newInstance(2020, 12, 31).getTime()/1000);
nsEstimate.put('entity', new Map<String, Object>{'internalId'=>'362'});
nsEstimate.put('entityStatus', new Map<String, Object>{'internalId'=>'8'});
nsEstimate.put('expectedCloseDate', DateTime.newInstance(2020, 12, 31).getTime()/1000);
nsEstimate.put('externalId', 'SFId: a012w00000Oyssh');
nsEstimate.put('memo', 'Order 25');
nsEstimate.put('otherRefNum', '4343399');
nsEstimate.put('probability', 35);
nsEstimate.put('title', 'SF Estimate');
nsEstimate.put('tranDate', DateTime.newInstance(2020, 09, 07).getTime()/1000);
// Initializing the Estimate Custom Fields
List<Object> estCustomFieldList = new List<Object>();
Map<String, Object> estCustomField = new Map<String, Object>();
estCustomField.put('fieldType', 'select');
estCustomField.put('scriptId', 'custbody_customlist');
estCustomField.put('valueLookup', new Map<String, Object>{'internalId'=>'2'});
estCustomFieldList.add(estCustomField);
// Adding the Estimate Custom Fields
nsEstimate.put('customFieldList', new Map<String, Object>{'customField'=>estCustomFieldList});
// Initializing the Estimate Line Items
List<Object> lineItemList = new List<Object>();
Map<String, Object> lineItem = new Map<String, Object>();
lineItem.put('description', 'A weapon for shooting arrows');
lineItem.put('item', new Map<String, Object>{'internalId'=>'239'});
lineItem.put('quantity', 1);
lineItem.put('rate', '999');
// Initializing the Line Item custom fields
List<Object> liCustomFieldList = new List<Object>();
Map<String, Object> liCustomField = new Map<String, Object>();
liCustomField.put('fieldType', 'boolean');
liCustomField.put('scriptId', 'custcol_checkbox');
liCustomField.put('value', 'true');
liCustomFieldList.add(liCustomField);
// Adding the Estimate Line Item Custom Fields
lineItem.put('customFieldList', new Map<String, Object>{'customField'=>liCustomFieldList});
lineItemList.add(lineItem);
// Adding the Line Items to Estimate
Map<String, Object> estimateLineitemList = new Map<String, Object>();
estimateLineitemList.put('item', lineItemList);
nsEstimate.put('itemList', estimateLineitemList);
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('estimates', new List<Object>{nsEstimate});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'createEstimate');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);