问题描述
我正在尝试在批处理请求中同时发送几个 quickbooks 查询.我遵循了 Intuit 在此处提供的格式 https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/00700_batch_operation 但我一直收到 ValidationFault.我不确定是什么导致了错误,所以任何帮助将不胜感激.谢谢!
I'm trying to send a couple of quickbooks queries together in a batch request. I've followed the formatting that Intuit gives here https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/00700_batch_operation but I keep getting a ValidationFault. I'm not sure what's causing the error, so any help would be greatly appreciated. Thanks!
XML:
<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
<BatchItemRequest bId="1" >
<Query query="Select * from Payment WHERE CustomerRef = '1933' ORDERBY TxnDate DESC MAXRESULTS 1"/>
</BatchItemRequest>
<BatchItemRequest bId="2" >
<Query query="Select * from Payment WHERE CustomerRef = '290' ORDERBY TxnDate DESC MAXRESULTS 1"/>
</BatchItemRequest>
</IntuitBatchRequest>
我收到的回复:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-02-07T12:47:32.442-08:00">
<BatchItemResponse bId="1">
<Fault type="ValidationFault">
<Error code="4000">
<Message>Error parsing query</Message>
<Detail>QueryParserError: Encountered "<EOF>" at line 0, column 0. Was expecting: "select" ...
</Detail>
</Error>
</Fault>
</BatchItemResponse>
<BatchItemResponse bId="2">
<Fault type="ValidationFault">
<Error code="4000">
<Message>Error parsing query</Message>
<Detail>QueryParserError: Encountered "<EOF>" at line 0, column 0. Was expecting: "select" ...
</Detail>
</Error>
</Fault>
</BatchItemResponse>
</IntuitResponse>
推荐答案
事实证明 Intuit 的文档不正确(至少对于它的 QBOv3 REST API).
It turns out Intuit's documentation is incorrect (at least for its QBOv3 REST API).
在 https://developer.intuit.com/docs/0025_quickbooksapi/00s05/020_key_concepts/00700_batch_operation Intuit 说 XML 应该按照我在第一篇文章中展示的方式进行格式化,但实际上应该像这样格式化:
At https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/00700_batch_operation Intuit says the XML should be formatted in the way I showed in my first post, but it should actually be formatted like so:
<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
<BatchItemRequest bId="1">
<Query>
Select * from Payment WHERE CustomerRef = '1933' ORDERBY TxnDate DESC MAXRESULTS 1
</Query>
</BatchItemRequest>
<BatchItemRequest bId="2">
<Query>
Select * from Payment WHERE CustomerRef = '290' ORDERBY TxnDate DESC MAXRESULTS 1
</Query>
</BatchItemRequest>
</IntuitBatchRequest>
我希望这能在未来帮助其他人!感谢所有回复,他们帮助缩小了问题的范围.
I hope this helps others in the future! Thanks for all of the replies, they helped to narrow down the issue.
这篇关于QBOv3 XML 验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!