When communicating with Quickbooks Desktop (via the Quickbooks Web Connector) from my web application, I can successfully add INDIVIDUAL time entries to Quickbooks using the following XML (QBXML) structure:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-22</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT1H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Test Note</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
</QBXMLMsgsRq>
</QBXML>
For reference this conforms to the Intuit API specification for TimeTrackingAdd requests.
HOWEVER, when I try to formulate a BATCH request (i.e. send multiple time entries in a single request) I get an error from Quickbooks:
"QuickBooks found an error when parsing the provided XML text stream."
The QBXML for my failing batch request is similar to the above: I simply repeat the <TimeTrackingAdd>
section with another valid (individually working) time entry:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-22</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT1H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Test Note</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
<TimeTrackingAdd>
<TxnDate>2022-10-23</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT2H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Test Note</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
</QBXMLMsgsRq>
</QBXML>
The QB XML Validator tool (provided in the QuickBooks SDK v15.0) is of little help. It validates the first individual transaction but chokes (I think internally) on the BATCH operation with "Error during validation: D, Conversion from string "Line: 31 LinePos: 21 Src Text:" to type 'Double' is not valid."
I thought that this was the correct way to batch requests - it seems that this approach is being used for 'ADD' requests on similar entities (like invoices).
I've hit my head on this for 2 days and can find no example anywhere on the web for a batch TimeTrackingAdd request or concrete information on how to batch Quickbooks Desktop 'Add' requests in general. I believe that it's important to batch these requests to efficiently process user timesheets and to provide timesheet atomicity, i.e. that if a timesheet fails ALL of the time-entries that it is comprised of will also not be created in Quickbooks - saving a potentially messy cleanup where some time-entries (within a single user weekly timesheet) succeed and others fail.
I will award points for a working QBXML sample or any comments that help me solve my problem.