Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

How to get a banktransaction record from the Xero API using xere-node

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")')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...