quickbooksqbxml

How do you supply multiple TxnIDs to a QBXML request?


From my understand there's only 1 request where you can pass a TxnIDList and that's TimeTrackingQuery. The XML i'm trying to pass is:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnId>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>

But this gives me an error of: There is a missing element: &quot;MaxReturned&quot;. Using the SDK validator, this query is marked as valid, however and looking at the documentation it says I can either supply a repeating element of TxnID or a MaxReturned value with nested elements.

If i also pass it a MaxReturned element along with the TxnIDs it will complain that the xml.

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnID>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
            <MaxReturned>1000</MaxReturned>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>

Lastly, if I close off the TimeTrackingQueryRq tag and re-open it and just include MaxReturned in the second tag, it will say it's valid XML but will return the same errors as the first request. Example of this:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnID>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
        </TimeTrackingQueryRq>
        <TimeTrackingQueryRq requestID="1">
            <MaxReturned>1000</MaxReturned>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>

So either I don't know how to pass a TxnIDList or I don't know how to properly read the documentation and provided schema. Any help or examples of how to properly construct this request is appreciated.


Solution

  • I found the problem. Just remove the attribute iterator="Start". Here is a reference about it.