Search code examples
intuit-partner-platform

Batching operation error (V3 API)


When trying to make a QBD batch request using the new V3 api, I'm getting errors that seem to indicate there are missing elements. I took the example in the docs (http://bit.ly/154KPWs) and simplified it:

<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
   <BatchItem  bId="bid1">
    <Customer>
       <Organization>false</Organization>
       <FullName>John Doe</FullName>
       <DisplayName>John Doe</DisplayName>
       <PrintOnCheckName>John Doe</PrintOnCheckName>
    </Customer>
  </BatchItem>
  <BatchItem  bId="bid2">
    <Customer>
       <Organization>false</Organization>
       <FullName>Jane Doe</FullName>
       <DisplayName>Jane Doe</DisplayName>
       <PrintOnCheckName>Jane Doe</PrintOnCheckName>
    </Customer>
   </BatchItem>
</IntuitBatchRequest>

Here's the response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-09-18T02:06:03.974Z"><Fault type="Validation"><Error code="0"><Message>UnmarshalException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'BatchItem'. One of '{&quot;http://schema.intuit.com/finance/v3&quot;:BatchItemRequest}' is expected.]</Message></Error></Fault></IntuitResponse>

Am I missing something or the docs?


Solution

  • Here is one working customer create request body.

    Request Body : <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3">
        <BatchItemRequest operation="create" bId="bID1">
            <Customer>
                <Organization>false</Organization>
                <Title>Job1</Title>
                <GivenName>TestCustomer1</GivenName>
                <MiddleName>SampleMiddleName1</MiddleName>
                <FamilyName>SampleSurname1</FamilyName>
                <Suffix>Sr.</Suffix>
                <CompanyName>ABCDGTech</CompanyName>
                <DisplayName>TestDataCustomerc7bceSample1</DisplayName>
                <PrintOnCheckName>Print name</PrintOnCheckName>
                <Active>true</Active>
                <PrimaryPhone>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>true</Default>
                    <Tag>Business</Tag>
                </PrimaryPhone>
                <AlternatePhone>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>false</Default>
                    <Tag>Business</Tag>
                </AlternatePhone>
                <Mobile>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>false</Default>
                    <Tag>Home</Tag>
                </Mobile>
                <Fax>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>false</Default>
                    <Tag>Business</Tag>
                </Fax>
                <PrimaryEmailAddr>
                    <Address>test@testing.com</Address>
                </PrimaryEmailAddr>
                <BillAddr>
                    <Line1>Testing1</Line1>
                    <Line2>Testing2</Line2>
                    <Line3>Testing3</Line3>
                    <City>Bangalore</City>
                    <Country>India</Country>
                    <CountrySubDivisionCode>KA</CountrySubDivisionCode>
                    <PostalCode>560097</PostalCode>
                </BillAddr>
                <ShipAddr>
                    <Line1>Shipping1</Line1>
                    <Line2>Shipping1</Line2>
                    <Line3>Shipping1</Line3>
                    <City>Bangalore</City>
                    <Country>India</Country>
                    <CountrySubDivisionCode>KA</CountrySubDivisionCode>
                    <PostalCode>560097</PostalCode>
                </ShipAddr>
                <ContactName>Contact Name</ContactName>
                <AltContactName>Alternate Name</AltContactName>
                <Notes>Testing Notes</Notes>
                <Job>false</Job>
                <Balance>100055.55</Balance>
                <OpenBalanceDate>2013-09-18</OpenBalanceDate>
                <BalanceWithJobs>5055.5</BalanceWithJobs>
                <CreditLimit>200000</CreditLimit>
                <AcctNum>Test020102</AcctNum>
                <ResaleNum>40</ResaleNum>
                <JobInfo>
                    <Status>InProgress</Status>
                    <StartDate>2013-09-16</StartDate>
                    <ProjectedEndDate>2013-09-23</ProjectedEndDate>
                    <EndDate>2013-09-23</EndDate>
                    <Description>In Progress</Description>
                </JobInfo>
            </Customer>
        </BatchItemRequest>
        <BatchItemRequest operation="create" bId="bID2">
            <Customer>
                <Organization>false</Organization>
                <Title>Job2</Title>
                <GivenName>TestCustomer2</GivenName>
                <MiddleName>SampleMiddleName2</MiddleName>
                <FamilyName>SampleSurname2</FamilyName>
                <Suffix>Sr.</Suffix>
                <CompanyName>ABCDGTechTech</CompanyName>
                <DisplayName>TestDataCustomerc48aaSample2</DisplayName>
                <PrintOnCheckName>Print name</PrintOnCheckName>
                <Active>true</Active>
                <PrimaryPhone>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>true</Default>
                    <Tag>Business</Tag>
                </PrimaryPhone>
                <AlternatePhone>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>false</Default>
                    <Tag>Business</Tag>
                </AlternatePhone>
                <Mobile>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>false</Default>
                    <Tag>Home</Tag>
                </Mobile>
                <Fax>
                    <DeviceType>LandLine</DeviceType>
                    <FreeFormNumber>(650)111-1111</FreeFormNumber>
                    <Default>false</Default>
                    <Tag>Business</Tag>
                </Fax>
                <PrimaryEmailAddr>
                    <Address>test@testing.com</Address>
                </PrimaryEmailAddr>
                <BillAddr>
                    <Line1>Testing1</Line1>
                    <Line2>Testing2</Line2>
                    <Line3>Testing3</Line3>
                    <City>Bangalore</City>
                    <Country>India</Country>
                    <CountrySubDivisionCode>KA</CountrySubDivisionCode>
                    <PostalCode>560097</PostalCode>
                </BillAddr>
                <ShipAddr>
                    <Line1>Shipping1</Line1>
                    <Line2>Shipping1</Line2>
                    <Line3>Shipping1</Line3>
                    <City>Bangalore</City>
                    <Country>India</Country>
                    <CountrySubDivisionCode>KA</CountrySubDivisionCode>
                    <PostalCode>560097</PostalCode>
                </ShipAddr>
                <ContactName>Contact Name</ContactName>
                <AltContactName>Alternate Name</AltContactName>
                <Notes>Testing Notes</Notes>
                <Job>false</Job>
                <Balance>100055.55</Balance>
                <OpenBalanceDate>2013-09-18</OpenBalanceDate>
                <BalanceWithJobs>5055.5</BalanceWithJobs>
                <CreditLimit>200000</CreditLimit>
                <AcctNum>Test020102</AcctNum>
                <ResaleNum>40</ResaleNum>
                <JobInfo>
                    <Status>InProgress</Status>
                    <StartDate>2013-09-16</StartDate>
                    <ProjectedEndDate>2013-09-23</ProjectedEndDate>
                    <EndDate>2013-09-23</EndDate>
                    <Description>In Progress</Description>
                </JobInfo>
            </Customer>
        </BatchItemRequest>
    </IntuitBatchRequest>
    

    Endpoint - https://quickbooks.api.intuit.com/v3/company/{RelamID}/batch?

    In your batch request,[ operation="create" ] is missing in BatchItemRequest tag.

    Code - batchOperation.addEntity(customer, OperationEnum.CREATE, "bID" + i);

    Hope It will be useful.

    Edit Adding Sample Query (using V3 java devkit)

    Item item = GenerateQuery.createQueryEntity(Item.class);
    Item itemIn = getItemFields();
    String query = select($(item.getId()), $(item.getDescription())).where($(item.getId()).eq(itemIn.getId())).generate();
    QueryResult queryResult = service.executeQuery(query);
    

    Generated req URI - https://quickbooks.api.intuit.com/v3/company/791926875/query?query=SELECT+Id%2C+Description+FROM+Item+WHERE+Id+%3D+%27null%27&

    Method - GET

    Thanks