0

You would think this is simple - but I can't get a simple bank transaction using XERO-API

To get the bank transaction in Xero itself I would go to:

https://go.xero.com/Bank/ViewTransaction.aspx?bankTransactionID=a6e0efbb-328f-4dd2-b50a-d4aa9f1c1993

I have tried the following: ( after creating the Xero client in nodejs which works fine for other API endpoints )

This one just hangs and does nothing. No timeout - no error - just hangs

const banktransaction = await xero.accountingApi.getBankTransaction(xero.tenants[0].tenantId, 'a6e0efbb-328f-4dd2-b50a-d4aa9f1c1993')

This one gives me no records back. I have tried various forms of the next type - strings with single quotes , double-quotes. All with errors. I am stumped.

const banktransaction = await xero.accountingApi.getBankTransactions(xero.tenants[0].tenantId, undefined, 'bankTransactionID=GUID("a6e0efbb-328f-4dd2-b50a-d4aa9f1c1993")')
Martin Thompson
  • 3,415
  • 10
  • 38
  • 62
  • What errors do you get? Do you have the correct scope for retrieving Bank Transactions? Accounting.transactions or accounting.transactions.read is required, I think. – droopsnoot Jan 01 '21 at 09:16
  • @droopsnoot No errors for the direct getBankTransaction call - it just hangs. that is the way I would prefer to call it. Yes it is the right scope ( I use the scopes for other calls that work and it it strongly typed into their typescript library ) – Martin Thompson Jan 02 '21 at 19:49
  • @droopsnoot I have actually posted q request on the Xero developer forums as well. – Martin Thompson Jan 02 '21 at 19:49

1 Answers1

0

posting my forum reply for anyone else.


We've got that in the sample app the same way (https://github.com/XeroAPI/xero-node-oauth2-app/blob/43c47fef1a81406dc094db277678118aba35ca7a/src/app.ts#L401)

Just a hunch but it probably has to do with the amount of data being fetched in your specific org. You can probably remedy this by adding a paging parameter or using some other filter such as if-modified-since.

We will get examples for those added to the readme asap.

https://developer.xero.com/documentation/api/banktransactions#GET

SerKnight
  • 2,502
  • 1
  • 16
  • 18
  • Thanks. Ideally I would like to get just the single transaction ( which hangs ) - but I will take a look at the other one with paging ( bit of a hack to get a single transaction! ) – Martin Thompson Jan 05 '21 at 21:09
  • Hmm a single get should not hang.. you should submit https://developer.xero.com/contact-xero-developer-platform-support/ with your specific api call details – SerKnight Jan 07 '21 at 17:56