Link

Request

Actions

It is a type of string used to define the type of action that needs to be performed. It generally accepts the following types of actions.

  • createContact: Creates a Xero Contact. (includes Xero Customers and Xero Vendors)
  • updateContact: Updates a Xero Contact. (includes Xero Customers and Xero Vendors)
  • fetchContacts: Fetches a single Xero Contact or a list of Xero Contacts from Xero.
  • createInvoice: Creates an Invoice in Xero.
  • updateInvoice: Updates in Invoice in Xero.
  • fetchInvoices: Fetches either a single Invoice or list of Invoices from Xero.
  • createBill: Creates a Bill in Xero.
  • updateBill: Updates a Bill in Xero.
  • fetchBills: Fetches either a single Bill or list of Bills from Xero.
  • createPurchaseOrder: Creates a Purchase Order (PO) in Xero.
  • updatePurchaseOrder: Updates a Purchase Order (PO) in Xero.
  • fetchPurchaseOrders: Fetches either a single Purchase Order or a list of Purchase Orders from Xero.

RequestObject - Class

You have to create an Instance for RequestObject and pass to the “BreadwinnerAPI.call()” method as one of the parameters.

BreadwinnerAPI.RequestObject request = new BreadwinnerAPI.RequestObject(); 

It consists of the following variables:

1. xeroContact

It is an instance of the AccountWrapper (Xero Contact Wrapper) class. To Create/Insert a Xero Contact, we should pass the desired values to the respective variables. For available xeroContact variables, please refer here

    List<bw_xero_api02.BreadwinnerAPI.AccountWrapper> xeroContactList = new list<bw_xero_api02.BreadwinnerAPI.AccountWrapper>();
    bw_xero_api02.BreadwinnerAPI.AccountWrapper xeroContact = new bw_xero_api02.BreadwinnerAPI.AccountWrapper();
    xeroContact.name = 'Test Customer';
    xeroContactList.add(xeroContact);
    request.xeroContact = xeroContactList;

2. xeroInvoice

It is an instance of the Invoice wrapper class. To Create/Insert customer we should pass desired values to variables. For all Invoice variables you can refer here

    List<bw_xero_api02.BreadwinnerAPI.Invoice> xeroInvoiceList = new list<bw_xero_api02.BreadwinnerAPI.Invoice>();
    bw_xero_api02.BreadwinnerAPI.Invoice xeroInvoice = new bw_xero_api02.BreadwinnerAPI.Invoice();
    xeroInvoice.CustomerId = 'Test Customer'; 
    xeroInvoice.description = 'desc';… 
    xeroInvoiceList.add(xeroInvoice);
    request.xeroInvoice = xeroInvoiceList;

3. options

It is a collection of type Map (Map<String, Object>), used to pass any type of filters that to be passed in the request or any config settings that we enable. below are the options can be used while fetching records.

Contacts: ContactId, ContactNumber, where, PageNumber, ModifiedAfter
Invoices, Bills: InvoiceNumber, InvoiceId, where, PageNumber, ModifiedAfter
PurchaseOrders: PurchaseOrderNumber, PurchaseOrderID, where, PageNumber, ModifiedAfter

request.options.put('PageNumber','1');