Question

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>

Response I get back:

<?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 &quot;&lt;EOF&gt;&quot; at line 0, column 0. Was expecting: &quot;select&quot; ...
                </Detail>
            </Error>
        </Fault>
    </BatchItemResponse>
    <BatchItemResponse bId="2">
        <Fault type="ValidationFault">
            <Error code="4000">
                <Message>Error parsing query</Message>
                <Detail>QueryParserError: Encountered &quot;&lt;EOF&gt;&quot; at line 0, column 0. Was expecting: &quot;select&quot; ...
                </Detail>
            </Error>
        </Fault>
    </BatchItemResponse>
</IntuitResponse>
Was it helpful?

Solution

It turns out Intuit's documentation is incorrect (at least for its QBOv3 REST API).

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.

OTHER TIPS

Your query should look like

SELECT * from Payment WHERE

NOT

query * from Payment WHERE

The CustomerRef is actually an entity of ReferenceType and you are sending the value for it. Try CustomerRef.value = "123"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top