如何查询帐户以仅获取快速手册中的单个对象? [英] How to query an account to get only single object in quickbooks?

查看:41
本文介绍了如何查询帐户以仅获取快速手册中的单个对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am calling this function to get the accounts details with particular Name

  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);
  };

但是它给了我一个数组中的数据

However it is giving me data in an array

{
  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可以获取单个对象而不是数组,或者我可以传递一些参数来获取对象吗?

So I need to know is there any api to get single object instead of array in quickbooks or can I pass some parameter to get object?

推荐答案

这个问题是针对 quickbooks api 的.我以前从未使用过这个 API,但是按照文档,他们提供了过滤数据查询,如 SQL

This question is quite specific for quickbooks api. I never use this API before, but following the document, they provide filter data query like SQL

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

So, I think you can use a same api and change query. Something like SELECT * FROM your_table WHERE id = your_book_id

这篇关于如何查询帐户以仅获取快速手册中的单个对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆