NodeDad
NodeDad

Reputation: 1537

QuickBooks CustomerAdd request failing due to malformed xml?

Question: Am i sending the proper XML request? AM i missing any required information? I'm using the following documentation from QuickBooks to compare XMLOps: https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html

Im creating a new LoopbackJS Connector for QuickBooks and ive ran into a snag when creating new records, i can query records perfectly fine.

I've looked at several other qbXML requests when it comes to Adding new records, specifically the CustomerAdd request and what im sending off to the Web Connector seems to be exactly what others are using (and its working for them). My guess is somethings wrong within the loopback-connect-quickbooks itself and not the request im sending but im gonna give it a go and post it anyways. Thanks in advance.

<?xml version="1.0"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <CustomerAddRq requestID="2">
      <CustomerAdd>
        <FirstName>Anne</FirstName>
        <MiddleName>B</MiddleName>
        <LastName>Williams</LastName>
        <Name>Anne B Williams</Name>
        <ShipToAddress>
          <Name>Anne B Williams</Name>
        </ShipToAddress>
      </CustomerAdd>
    </CustomerAddRq>
  </QBXMLMsgsRq>
</QBXML>

Upvotes: 1

Views: 102

Answers (1)

Keith Palmer Jr.
Keith Palmer Jr.

Reputation: 27962

Refer to the OSR again, and remember -- the order of the tags IS important.

The OSR shows the tags in this order:

<Name >STRTYPE</Name> <!-- required -->
...
<FirstName >STRTYPE</FirstName> <!-- optional -->
<MiddleName >STRTYPE</MiddleName> <!-- optional -->
<LastName >STRTYPE</LastName> <!-- optional -->

And you have them in this order:

    <FirstName>Anne</FirstName>
    <MiddleName>B</MiddleName>
    <LastName>Williams</LastName>
    <Name>Anne B Williams</Name>

You must follow the order of the tags shown in the OSR. Fix the order of the tags and your request should go through fine.

Side note - there's an XML Validator tool included with the QuickBooks SDK that will tell you EXACTLY what your error is in cases like this.

Upvotes: 2

Related Questions