Quickbook SalesOrderQueryRq xml provide QuickBooks found an error when parsing the provided XML text stream - quickbooks

I want to get sales order from Quickbook Desktop.
From Quickbook reference i am using Salesorderquery(2.1)
Below is the XML i am using
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderQueryRq metaData="ENUMTYPE" iterator="ENUMTYPE" iteratorID="UUIDTYPE"/>
</QBXMLMsgsRq>
</QBXML>
but when i try to test the xml request via SDKTESTPLUS3 i am getting below error
QuickBooks found an error when parsing the provided XML text stream.
Can you please tell me what i am doing wrong in this request.

You have a few problems here:
metaData="ENUMTYPE" - This is an enum (https://en.wikipedia.org/wiki/Enumerated_type), and ENUMTYPE is not a valid value for the enum. Either remove this attribute, or specify a valid type.
iterator="ENUMTYPE" - This is also an enum, same deal.
iteratorID="UUIDTYPE" - This is supposed to be a UUID. If you aren't continuing an iterator, you should leave this attribute out. Otherwise, use the UUID for the iterator.
Also, some versions of QuickBooks use an XML parser that doesn't like self-closed tags. Try this instead:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderQueryRq></SaalesOrderQueryRq>
</QBXMLMsgsRq>
</QBXML>

Related

XML Error while Modifying Sales Order in QB Desktop

I am trying to modify a sales order created in QB Desktop. But it gives me XML error
0x80040400: QuickBooks found an error when parsing the provided XML text stream.
Here is my XML Request
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="11.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderModRq>
<SalesOrderMod>
<TxnID>1-1672737866</TxnID>
<EditSequence>1672737866</EditSequence>
<CustomerRef>
<FullName>156004 Loose Bee Ln</FullName>
</CustomerRef>
<TxnDate>2023-01-03</TxnDate>
<BillAddress>
<Addr1>123</Addr1>
<Addr2></Addr2>
<City>Gity</City>
<State>Ritham</State>
<PostalCode>5555</PostalCode>
<Country>Universe</Country>
</BillAddress>
<PONumber>4444444</PONumber>
<Other>Southshore Bay</Other>
<SalesOrderLineMod>
<TxnID>3-1672737866</TxnID
<ItemRef>
<FullName>Single Family - One Story</FullName>
</ItemRef>
<Desc>Foundation</Desc>
<Quantity>1</Quantity>
<Amount>85.00</Amount>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>Lot</DataExtName>
<DataExtValue>8/98</DataExtValue>
</DataExtMod>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>Address</DataExtName>
<DataExtValue>156004 Loose Bee Ln</DataExtValue>
</DataExtMod>
</SalesOrderLineMod>
</SalesOrderMod>
</SalesOrderModRq>
</QBXMLMsgsRq>
</QBXML>
Any help is highly appreciatable..
Whenever you get this error:
0x80040400: QuickBooks found an error when parsing the provided XML text stream
It means you used an XML tag incorrectly, an unsupported XML tag, or an XML tag in the wrong order.
You can refer to the documentation to see what supported tags, their order, etc. are:
https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salesordermod
At least at first glance, I can see that TxnID inside SalesOrderLineMod is not correct (maybe you meant TxnLineID instead?):
<SalesOrderLineMod>
<TxnID>3-1672737866</TxnID
It may also be worth double-checking those DataExtMod tags too.

QBXML SalesOrderAdd issue

I am trying to create SalesOrder through QBWebConnector (backend - Rails + qbwc), following Onscreen Reference for Intuit Software Development Kits, and it says that SalesOrderAdd requires only CustomerRef attribute, but QBXML validator says:
Line: 10
LinePos: 9
Src Text: </SalesOrderAdd>
Reason: Element content is incomplete according to the DTD/Schema.
Expecting: ClassRef, TemplateRef, TxnDate, RefNumber, BillAddress, ShipAddress, PONumber, TermsRef, DueDate, SalesRepRef, FOB, ShipDate.
QBXML Request is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderAddRq>
<SalesOrderAdd>
<CustomerRef>
<FullName>Test customer</FullName>
</CustomerRef>
</SalesOrderAdd>
</SalesOrderAddRq>
</QBXMLMsgsRq>
</QBXML>
Why is that? Can I change this behavior somehow (omit all tags except pointed as required in Onscreen Reference)?
The OSR is... less than perfect. But it does indicate there are additional required fields.
You need to add at least one line item or group line.

Quickbooks QBXML - how to exclude fields

I want to get all inventory items from quickbooks with only full name and quantity on hand fields, in order to get a smaller xml. Do you know how to achieve this?
This is the xml query request:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="10.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ItemInventoryQueryRq>
</ItemInventoryQueryRq>
</QBXMLMsgsRq>
</QBXML>
You can use this tag to pick specifically which fields you want to include:
<IncludeRetElement>
For example, this gets invoices, but only the TxnID, EditSequence, and RefNumber fields:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq requestID="abcd1234">
<TxnID>ABCD-1234</TxnID>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>EditSequence</IncludeRetElement>
<IncludeRetElement>RefNumber</IncludeRetElement>
</InvoiceQueryRq>
</QBXMLMsgsRq>
</QBXML>
Example from this wiki:
http://www.consolibyte.com/docs/index.php/QbXML_for_Querying_for_Invoices,_and_limiting_returned_info
http://www.consolibyte.com/docs/index.php/Example_qbXML_Requests
You may also want to reference Intuit's documentation which shows this, the QuickBooks OSR:
https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html

how to add payment method to quickbooks through qbxml?

I'm using consolibyte php with web connector.I'm trying to create payment method add request using following xml.But i'm getting following error.but in quickbooks with that name no term existed.can you help any one?
3100: The name "cashondelivery" of the list element is already in use.
$xml='<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<PaymentMethodAddRq>
<PaymentMethodAdd>
<Name>cashondelivery</Name>
<IsActive>true</IsActive>
<PaymentMethodType>AmericanExpress</PaymentMethodType>
</PaymentMethodAdd>
</PaymentMethodAddRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
That means that cashondelivery is already in QB.
Look for deleted entries as well. You might need to check the other lists and see if it is there.

QuickBooks. Filtering items by LinkedTxn

I would like to get the ItemReceipt items that have LinkedTxn  with the PurchaseOrder type.
Now I use the following query:
<?xml version="1.0" encoding="utf-8"?><?qbxml version="12.0"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<ItemReceiptQueryRq requestID="1">
<IncludeLineItems>true</IncludeLineItems>
<IncludeLinkedTxns>true</IncludeLinkedTxns>
<OwnerID>0</OwnerID>
</ItemReceiptQueryRq>
</QBXMLMsgsRq>
</QBXML>
The query returned all ItemReceipt items, and I filtred them on the client. 
Could you tell me if there is a way to create a filter that returns only items that have LinkedTxn with the PurchaseOrder type?
The QuickBooks SDK does not support a way to create a filter that returns only items that have a LinkedTxn with a certain type.
You'll have to pull all of the transactions, and then filter them within your app.

Resources