如何查询帐户以仅获取快速簿中的单个对象?
How to query an account to get only single object in quickbooks?
我正在调用此函数以获取具有特定名称的帐户详细信息
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
}
所以我需要知道在 quickbooks 中是否有任何 api 来获取单个对象而不是数组,或者我可以传递一些参数来获取对象吗?
这个问题对于 quickbooks 来说非常具体 api。我以前从来没有用过这个API,但是按照文档,他们提供了像SQL
这样的过滤数据查询
因此,我认为您可以使用相同的 api 并更改查询。类似于 SELECT * FROM your_table WHERE id = your_book_id
我正在调用此函数以获取具有特定名称的帐户详细信息
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
}
所以我需要知道在 quickbooks 中是否有任何 api 来获取单个对象而不是数组,或者我可以传递一些参数来获取对象吗?
这个问题对于 quickbooks 来说非常具体 api。我以前从来没有用过这个API,但是按照文档,他们提供了像SQL
因此,我认为您可以使用相同的 api 并更改查询。类似于 SELECT * FROM your_table WHERE id = your_book_id