批处理操作错误(V3 API)

时间:2013-09-18 02:46:54

标签: intuit-partner-platform

当尝试使用新的V3 api进行QBD批量请求时,我收到的错误似乎表明缺少元素。我在文档(http://bit.ly/154KPWs)中进行了示例并简化了它:

<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>

以下是回复:

<?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>

我错过了什么或文档吗?

1 个答案:

答案 0 :(得分:2)

这是一个工作客户创建请求正文。

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>

端点 - https://quickbooks.api.intuit.com/v3/company/ {RelamID} /批量?

在批量请求中,BatchItemRequest标记中缺少[ operation =“create”]。

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

希望它会有用。

编辑添加示例查询(使用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);

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

方法 - GET

由于