Global API
...
Request
Contact
Create
1min
The following is an example to create a Customer with every possible field available (See Contact for the available fields)
Request
Response
// Create a Map to store all the data of a Contact Map<String, Object> contactMap = new Map<String, Object>(); contactMap.put('Name', 'Breadwinner Inc'); contactMap.put('FirstName', 'Jack'); contactMap.put('LastName', 'Rogers'); contactMap.put('EmailAddress', 'jrogers@burlington.com'); List<Object> phonesList = new List<Object>(); Map<String, Object> DefaultPhone = new Map<String, Object>(); DefaultPhone.put('PhoneType', 'DEFAULT'); DefaultPhone.put('PhoneNumber', '9988543562'); phonesList.add(DefaultPhone); contactMap.put('Phones', phonesList); List<Object> addressList = new List<Object>(); Map<String, Object> shippingAddressMap = new Map<String, Object>(); shippingAddressMap.put('AddressType', 'STREET'); shippingAddressMap.put('Country', 'India'); shippingAddressMap.put('AddressLine3', 'Kodad'); shippingAddressMap.put('AddressLine2', 'First Lane'); shippingAddressMap.put('AddressLine1', '1-24'); shippingAddressMap.put('PostalCode', '508238'); shippingAddressMap.put('City', 'Suryapet'); shippingAddressMap.put('Region', 'India'); shippingAddressMap.put('AttentionTo', 'User'); addressList.add(shippingAddressMap); Map<String, Object> billingAddrFieldMap = new Map<String, Object>(); billingAddrFieldMap.put('AddressType', 'POBOX'); billingAddrFieldMap.put('Country', 'India'); billingAddrFieldMap.put('AddressLine3', ''); billingAddrFieldMap.put('AddressLine2', 'Srinagar Colony'); billingAddrFieldMap.put('AddressLine1', '1/78-24'); billingAddrFieldMap.put('PostalCode', '500008'); billingAddrFieldMap.put('City', 'Hyderabad'); billingAddrFieldMap.put('Region', 'India'); billingAddrFieldMap.put('AttentionTo', 'User'); addressList.add(billingAddrFieldMap); contactMap.put('Addresses', addressList); // Initializing the RequestJSON Data to be passed. Map<String, Object> requestJSONMap = new Map<String, Object>(); requestJSONMap.put('contacts', new List<Object>{contactMap}); String reqJSON = JSON.serialize(requestJSONMap); Map<String, Object> reqObj = new Map<String, Object>(); reqObj.put('version', '1.0'); reqObj.put('action', 'createContact'); reqObj.put('requestJSON', reqJSON); //Required, if Xero Multi-Org is enabled in Breadwinner. reqObj.put('xeroOrgId', '!aa00TM'); // Placing a request to Breadwinner Global API Map<String, Object> respMap = bread_winner.BreadwinnerXeroAPI.call(reqObj); System.debug(respMap);