I'm new to Xero and the Xero data model but essentially I'm looking to fetch the "Chart of accounts" data via the Xero API. I need to find all transactions allocated to each expense account, i.e. "Advertising, Cleaning" etc over a specified time frame.
From my understanding, the BankTransactions
endpoint response contains the BankAccount.AccountID
of the account used to pay a transaction, not the expense account the cost was allocated to.
Xero doesn't currently have the ability to return the information you mention as a single request through API at this stage.
Every transaction created in Xero that effects the general ledger creates an accounting journal in the background. Typically you can only see these journals in the Journal report found in the Report Centre, however they are also available via the API.
If you pull all the journals from the organisation you'll be able to build your own reports as required. To do this you would need to perform an initial process to retrieve the complete set of journals. If these were then stored locally it would only need to be a one-time process. Subsequent updates would only need to retrieve any new journals.