简体   繁体   English

QBO v2 API发票查询迅速发展

[英]QBO v2 API Invoice query goes boom

peeps! 偷看! I'm attempting to load an invoice from Quickbooks online using v2 of the Java API with the following code: 我正在尝试使用Java API v2和以下代码从Quickbooks在线加载发票:

    public String getInvoiceFoo(String docNumber, PlatformSessionContext context) throws QBInvalidContextException, Exception {
    QBInvoiceQuery query = new QBInvoiceQuery(context);
    query.setDocNumber(docNumber);
    QBInvoiceService invoiceService = QBServiceFactory.getService(context, QBInvoiceService.class);
    QBInvoice qbInvoice = invoiceService.getInvoices(context, query).get(0);
    return qbInvoice.getHeader().getDocNumber();
}

This seemingly simple query results in the following error: 这个看似简单的查询会导致以下错误:

Error: 400 <?xml version="1.0" encoding="UTF-8" standalone="yes"?><FaultInfo xmlns="http://www.intuit.com/sb/cdm/baseexceptionmodel/xsd"><Message>Search Criteria has invalid PropertyName: DocNumber</Message><ErrorCode>BAD_QUERY_REQUEST</ErrorCode><Cause>QUERY_INVALID_SEARCH_CRITERIA</Cause></FaultInfo>

The server seems to complain about DocNumber being an invalid property. 服务器似乎抱怨DocNumber是无效的属性。 Has anyone else successfully queried invoices by number? 是否有其他人成功地按号码查询了发票?

Filtering by docnumber is not supported for Invoices in V2 QBO. V2 QBO中的发票不支持按文档编号过滤。 Please refer: https://developer.intuit.com/docs/95_deprecated/qbo_v2/0400_qbo_v2_reference/invoice 请参考: https : //developer.intuit.com/docs/95_deprecated/qbo_v2/0400_qbo_v2_reference/invoice

Please use V3 services for this. 请为此使用V3服务。

I too got the same problem while using V2 Invoice. 使用V2发票时我也遇到了同样的问题。

I tried this Filter= DocNumber :EQUALS: f96fa 我试过了这个Filter= DocNumber :EQUALS: f96fa

Filter support only provided for Estimate entity. 仅为估算实体提供过滤器支持。

V2 will be deprecated. V2将不推荐使用。 If possible, try this using V3. 如果可能,请使用V3尝试此操作。 It is working fine. 一切正常。

    Invoice invoice = GenerateQuery.createQueryEntity(Invoice.class);
    String invoiceQuery = select($(invoice)).where($(invoice.getDocNumber()).eq("f96fa")).generate();
    //SELECT * FROM Invoice WHERE DocNumber = 'f96fa'
    this.service.executeQuery(invoiceQuery);

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM