首页 > 解决方案 > How to filter for a object wiith a "value" and "name" in QBO api?

问题描述

It seems like its the api won't permit a query filter of the form:

select * from purchaseorder where APAccountRef.value='33'

In the case of purchase orders it seems to mean that I need to bring down every purchase order to my server and scan for the account I need which is highly suboptimal. Is there some other syntax for querying against the many attributes which have been encoded like

"APAccountRef": {
          "value": "33",
          "name": "Accounts Payable (A/P)"
        }

with just a name and value attribute?

标签: quickbooksquickbooks-online

解决方案


如果您参考文档:

它为您提供了所有字段的列表,以及filterable. 您的查询使用的字段不存在Purchase Orders

AccountRef.value='39'

正确的字段是:

APAccountRef:
required  
ReferenceType, filterable 
Specifies to which AP account the bill is credited. 

所以你的查询应该是:

SELECT * FROM purchaseorder WHERE APAccountRef = '39'


推荐阅读