如何使用 xere-node 从 Xero API 获取银行交易记录

问题描述

您会认为这很简单 - 但我无法使用 XERO-API 进行简单的银行交易

要在 Xero 本身中进行银行交易,我会去:

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

我尝试了以下方法: (在 nodejs 中创建 Xero 客户端后,它适用于其他 API 端点)

这个只是挂起,什么也不做。没有超时 - 没有错误 - 只是挂起

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

这个没有给我任何记录。我尝试了下一种类型的各种形式——带单引号、双引号的字符串。都有错误。我被难住了。

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

解决方法

为其他人发布我的论坛回复。


我们在示例应用中以同样的方式获得了它 (https://github.com/XeroAPI/xero-node-oauth2-app/blob/43c47fef1a81406dc094db277678118aba35ca7a/src/app.ts#L401)

只是一种预感,但这可能与您的特定组织中获取的数据量有关。您可以通过添加分页参数或使用其他过滤器(例如 if-modified-since)来解决此问题。

我们将尽快获取添加到自述文件中的示例。

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