如何查询一个帐户以在快速簿中只获取一个对象



我调用此函数来获取具有特定名称的帐户详细信息

const getAccount = async ({ realmId, auth }) => {
const postBody = {
url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${realmId}/query?query=select * from Account where Name='Sales of Product Income'`,
headers: {
Accept: "application/json",
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth
}
};
const data = await rp.get(postBody);
return JSON.parse(data);
};

然而,它在阵列中给了我数据

{
Account: [
{
Name: 'Sales of Product Income',
SubAccount: false,
FullyQualifiedName: 'Sales of Product Income',
Active: true,
Classification: 'Revenue',
AccountType: 'Income',
AccountSubType: 'SalesOfProductIncome',
CurrentBalance: 0,
CurrentBalanceWithSubAccounts: 0,
CurrencyRef: [Object],
domain: 'QBO',
sparse: false,
Id: '79',
SyncToken: '0',
MetaData: [Object]
}
],
startPosition: 1,
maxResults: 1
}

所以我需要知道是否有任何api来获取quickbooks中的单个对象而不是数组,或者我可以传递一些参数来获取对象吗?

这个问题对于quickbooks api来说非常具体。我以前从未使用过这个API,但在文档之后,他们提供了类似SQL的过滤数据查询

所以,我认为您可以使用相同的api并更改查询。类似SELECT * FROM your_table WHERE id = your_book_id

最新更新