Skip to main content

queryMore()

Zuora
  • 日本語のコンテンツは機械翻訳されており、補助的な参照を目的としています。機械翻訳の精度は保証できません。英語版が正となります。また、現時点では検索機能は日本語での検索をサポートしていません。翻訳に関するフィードバックについては、docs@zuora.comに送信してください。

  • US Data Center Customers: The SOAP API is no longer under active development. The legacy SOAP calls still function, but are now also available in REST.

    EU Data Center Customers: The SOAP API is not available. Please use the REST API.

    APAC Data Center Customers: The SOAP API is not available. Please use the REST API.

    Going forward, new features will only be available through the REST API. We strongly recommend that all integrations are done using the REST API.

    You can find the REST API documentation at https://www.zuora.com/developer/.

queryMore()

Overview

Use queryMore() to request additional results from a previous query() call. If your initial query() call returns more than 2000 results, you can use queryMore() to query for the additional results.  This SOAP API reference describes this call.

Usage

As of the September 2014, R180 release, Zuora will continue to store results greater than 2,000 with queryLocator. Any queryLocator results greater than 2,000, will only be stored by Zuora for 5 days before it is deleted.

 

This call sends a request for additional results from an initial query() call. If the initial query() call returns more than 2000 results, you can use the queryLocator returned from query() to request the next set of results. By default, 2000 results will be returned with the queryMore() call, but this can be changed by setting batchSize in QueryOptions.

You can set the number of results to return by setting BatchSize in SOAP header. It can be a number between 0 and 2000. Setting to 0 is the default setting, which will return 2000 results.

As of WSDL 20.0, Zuora will now expire queryMore() cursors after 15 minutes of activity, regardless of the API version that you are using.

Syntax and Arguments

To use queryMore(), you first construct a query() call. By default, the query() call will return up to 2000 results. If there are more than 2000 results, query() will return a boolean "done," which will be marked as false, and a queryLocator, which is a marker you will pass to queryMore() to get the next set of results.

Example of Using queryMore()

A typical request could be:

1SELECT Id FROM InvoiceItem

Typically, Zuora would return 2000 results (100 results with WSDL version 5.0 and below). However, if your query exceeds this limit, you can use queryMore() to request the remaining results.

The following is an example that makes a query and requests that only 50 results be returned.

01<?xml version="1.0" encoding="UTF-8"?>
03    <SOAP-ENV:Header>
04        <ns2:SessionHeader>
05            <ns2:session>x325DpHqCwv9ya830FxMUddE...</ns2:session>
06        </ns2:SessionHeader>
07        <ns2:QueryOptions>
08            <ns2:batchSize>50</ns2:batchSize>
09        </ns2:QueryOptions>
10    </SOAP-ENV:Header>
11    <SOAP-ENV:Body>
12        <ns1:query>
13            <ns1:queryString>select id from invoiceitem</ns1:queryString>
14        </ns1:query>
15    </SOAP-ENV:Body>
16</SOAP-ENV:Envelope>

The resulting response would be:

01<?xml version="1.0" encoding="utf-8"?>
02<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
03    <soapenv:Body>
04        <ns1:queryResponse xmlns:ns1="http://api.zuora.com/">
05            <ns1:result>
06                <ns1:done>false</ns1:done>
07                <ns1:queryLocator>4028e69923eaaa2a0124069b5c887849-50</ns1:queryLocator>
08                <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItem">
09                    <ns2:Id>4028e6991f1b0aa5011f1c82a53a0054</ns2:Id>
10                </ns1:records>
11                <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItem">
12                    <ns2:Id>4028e6991f1b0aa5011f1c82a56e0055</ns2:Id>
13                </ns1:records>
14<!-- ...48 more results... -->
15                <ns1:size>1104</ns1:size>
16            </ns1:result>
17        </ns1:queryResponse>
18    </soapenv:Body>
19</soapenv:Envelope>

Step 2: Take queryLocator, issue queryMore() Call

With the queryLocator, you can now construct a queryMore() request which will return another set of results. An example use of queryMore() in this case would be:

01<?xml version="1.0" encoding="UTF-8"?>
03    <SOAP-ENV:Header>
04        <ns2:SessionHeader>
05            <ns2:session>x325DpHqCwv9ya830FxMUddE...</ns2:session>
06        </ns2:SessionHeader>
07        <ns2:QueryOptions>
08            <ns2:batchSize>50</ns2:batchSize>
09        </ns2:QueryOptions>
10    </SOAP-ENV:Header>
11    <SOAP-ENV:Body>
12        <ns1:queryMore>
13            <ns1:queryLocator>4028e69923eaaa2a0124069b5c887849-50</ns1:queryLocator>
14        </ns1:queryMore>
15    </SOAP-ENV:Body>
16</SOAP-ENV:Envelope>

The queryMore() call returns a queryMoreResponse, almost identical to a queryResponse:

01<?xml version="1.0" encoding="utf-8"?>
02<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
03    <soapenv:Body>
04        <ns1:queryMoreResponse xmlns:ns1="http://api.zuora.com/">
05            <ns1:result>
06                <ns1:done>false</ns1:done>
07                <ns1:queryLocator>4028e69923eaaa2a0124069b5c887849-1050</ns1:queryLocator>
08                <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItem">
09                    <ns2:Id>4028e69923eaaa2a0124022c44522584</ns2:Id>
10                </ns1:records>
11                <ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItem">
12                    <ns2:Id>4028e69923eaaa2a0124022e1b8527cd</ns2:Id>
13                </ns1:records>
14<!-- ...48 more results...>
15            </ns1:result>
16        </ns1:queryMoreResponse>
17    </soapenv:Body>
18</soapenv:Envelope>

Step 3: Iteratively call queryMore()

Iteratively call queryMore() until done=true.

English
日本語