Global API
...
Request
Bill
Update
1min
To update a Bill in Xero, make sure you set the field "InvoiceID" with the unique reference value (ID generated by Xero for the Bill)
Request
Response
// Create a Map to store all the data of a Bill List<Object> invoiceList = new List<Object>(); Map<String, Object> invoiceMap = new Map<String, Object>(); invoiceMap.put('InvoiceID', '192d2166-7cfa-4f30-89c1-9ad1dc1f55df'); invoiceMap.put('Status', 'AUTHORISED'); invoiceMap.put('InvoiceNumber', 'Test Bill'); // Updating the Bill Line Items List<Object> lineItemList = new List<Object>(); Map<String, Object> lineItemMap = new Map<String, Object>(); lineItemMap.put('Description', 'Line Item Description Updated'); lineItemMap.put('LineItemID', '1294d14b-30e6-4c76-85f5-d66de2c02b83'); lineItemMap.put('UnitAmount', 100); lineItemMap.put('Quantity', 10); lineItemMap.put('AccountCode', '200'); lineItemList.add(lineItemMap); // Adding the Line Items to Bill invoiceMap.put('LineItems', lineItemList); invoiceList.add(invoiceMap); // Initializing the RequestJSON Data to be passed. Map<String, Object> reqJSONMap = new Map<String, Object>(); reqJSONMap.put('invoices', invoiceList); String reqJSON = JSON.serialize(reqJSONMap); Map<String, Object> finalReqMap = new Map<String, Object>(); finalReqMap.put('version', '1.0'); finalReqMap.put('action', 'updateBill'); finalReqMap.put('RequestJSON', reqJSON); finalReqMap.put('skipDML', false); //Required, if Xero Multi-Org is enabled in Breadwinner. finalReqMap.put('xeroOrgId', '!aa00TM'); System.debug('Request ::: ' + finalReqMap); // Placing a request to Breadwinner Global API Map<String, Object> respMap = bread_winner.BreadwinnerXeroAPI.call(finalReqMap); System.debug('Response ::: ' + respMap);