searchMoreWithId

In SOAP web services, the searchMoreWithId operation enables you to reference a specific search result set by its searchId, a parameter included in all search results.

When you paginate through the search results, the searchMoreWithId operation triggers a new search for the page specified by the pageIndex value.

SOAP Samples

The following samples show the SOAP request for the initial search as well as the SOAP request for a subsequent searchMoreWithId operation used to specify the next page of the search. The ID returned in the initial search is specified as the searchId when executing searchMoreWithId.

The first sample shows the initial search.

            <soapenv:Envelope>
    <soapenv:Header>
        <platformMsgs:searchPreferences>
            <platformMsgs:bodyFieldsOnly>true</platformMsgs:bodyFieldsOnly>
            <platformMsgs:pageSize>100</platformMsgs:pageSize>
        </platformMsgs:searchPreferences>
        <platformMsgs:passport>
            <platformCore:email>jdoe@netsuite.com</platformCore:email>
            <platformCore:password><SOAP web services password></platformCore:password>
            <platformCore:account>000034</platformCore:account>
            <platformCore:role internalId="37"/>
        </platformMsgs:passport>
    </soapenv:Header>
    <soapenv:Body>
        <platformMsgs:search>
            <searchRecord xsi:type="platformCommon:ContactSearchBasic">
                <platformCommon:city operator="is" xsi:type="platformCore:SearchStringField">
                    <platformCore:searchValue xsi:type="xsd:string">San Francisco</platformCore:searchValue>
                </platformCommon:city>
            </searchRecord>
        </platformMsgs:search>
    </soapenv:Body>
</soapenv:Envelope> 

          

The following sample shows the result of the initial search. Note the searchId in the response.

            <soapenv:Envelope>
    <soapenv:Header>
        <platformMsgs:documentInfo>
            <platformMsgs:nsId>WEBSERVICES_528736_07012008543995006307049233_d53ef4d2273b15<
      platformMsgs:nsId>
        </platformMsgs:documentInfo>
    </soapenv:Header>
    <soapenv:Body>
        <platformMsgs:searchResponse>
          <platformCore:searchResult>
          <platformCore:status isSuccess="true"/>
          <platformCore:totalRecords>231</platformCore:totalRecords>
          <platformCore:pageSize>100</platformCore:pageSize>
          <platformCore:totalPages>3</platformCore:totalPages>
          <platformCore:pageIndex>1</platformCore:pageIndex>
            <platformCore: searchId > WEBSERVICES_528736_07012008543995006307049233_d53ef4d2273b15
      <platformCore: searchId >
           <platformCore:recordList>
           <platformCore:recordList>
                 <platformCore:record internalId="4" externalId="entity-4" xsi:type="listRel:Contact">
                      <listRel:entityId>john</listRel:entityId>
                      <listRel:firstName>John</listRel:firstName>
                        .....
                    </platformCore:record>
                </platformCore:recordList>
            </platformCore:searchResult>
        </searchMoreWithIdResponse>
    </soapenv:Body>
</soapenv:Envelope> 

          

In the following sample, you use the searchId to retrieve the next page of results using the searchMoreWithId operation.

            <soapenv:Envelope>
    <soapenv:Header>
        <platformMsgs:searchPreferences>
            <platformMsgs:bodyFieldsOnly>true</platformMsgs:bodyFieldsOnly>
            <platformMsgs:pageSize>100</platformMsgs:pageSize>
        </platformMsgs:searchPreferences>
        <platformMsgs:passport>
            <platformCore:email>jdoe@netsuite.com</platformCore:email>
            <platformCore:password><SOAP web services password></platformCore:password>
            <platformCore:account>000034</platformCore:account>
            <platformCore:role internalId="37"/>
        </platformMsgs:passport>
    </soapenv:Header>
    <soapenv:Body>
        <platformMsgs:searchMoreWithId>
            <searchId>WEBSERVICES_528736_07012008543995006307049233_d53ef4d2273b15</searchId>
            <pageIndex>2</pageIndex>
        </platformMsgs:searchMoreWithId>
    </soapenv:Body>
</soapenv:Envelope> 

          

The following example shows the result of the searchMoreWithId operation. The next page of results is returned.

            <soapenv:Envelope>
    <soapenv:Header>
        <platformMsgs:documentInfo>
            <platformMsgs:nsId>WEBSERVICES_528736_07012008543995006307049233_d53ef4d2273b15</platformMsgs:nsId>
        </platformMsgs:documentInfo>
    </soapenv:Header>
    <soapenv:Body>
        <platformMsgs:searchMoreWithIdResponse>
            <platformCore:searchResult>
         <platformCore:status isSuccess="true"/>
         <platformCore:totalRecords>231</platformCore:totalRecords>
         <platformCore:pageSize>100</platformCore:pageSize>
         <platformCore:totalPages>3</platformCore:totalPages>
         <platformCore:pageIndex>1</platformCore:pageIndex>
        <platformCore: searchId > WEBSERVICES_528736_07012008543995006307049233_d53ef4d2273b15
             </platformCore: searchId >
                <platformCore:recordList>
                    <platformCore:record internalId="5" externalId="entity-5" xsi:type="listRel:Contact">
                        <listRel:entityId>mike</listRel:entityId>
                        <listRel:firstName>Mike</listRel:firstName>
                        .....
                    </platformCore:record>
                </platformCore:recordList>
            </platformCore:searchResult>
        </platformMsgs:searchMoreWithIdResponse>
    </soapenv:Body>
</soapenv:Envelope> 

          

REST Samples

In REST web services, lists of record instances and the results of saved analytics workbook searches are returned in one or more pages. The results are displayed on multiple pages, with the default setting of 1000 results per page on a maximum of 1000 pages. This way you can return maximum one million results if you use SuiteAnalytics Connect. Without SuiteAnalytics Connect, you can display maximum 100 000 results.

You can also specify your own paging by adding the limit criteria to your request.

The following examples show how to move between pages of returned results.

First, you send a request for all instance of customer records, with two results displayed per page.

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=2 

          

The following example shows the response.

            {
    "links": [
        {
            "rel": "next",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/account?limit=2&offset=2"
        },
        {
            "rel": "last",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/account?limit=22&offset=2"
        },
        {
            "rel": "self",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=2&offset=0"
        }
    ],
    "items": [
        {
            "links": [
                {
                    "rel": "self",
                    "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107"
                }
            ],
            "id": "107"
        },
        {
            "links": [
                {
                    "rel": "self",
                    "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/41"
                }
            ],
            "id": "41"
        }
    ],
    "count": 2,
    "offset": 0,
    "hasMore": true,
    "totalResults": 3
} 

          

The values of the count, hasMore, and totalResults fields provide information about the results that you can retrieve in subsequent requests for other pages. Links to the last and next pages provide direct links that you can use to retrieve these pages.

You can retrieve the next page by sending a request with the offset value specified. The offset provides the index of the result from which you should start the requested page.

The following is an example of a request for the second (and last) page of results with all customers.

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/account?limit=2&offset=2 

          

The following example shows the result of the request.

            {
    "links": [
        {
            "rel": "prev",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=2&offset=0"
        },
        {
            "rel": "first",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=22&offset=0"
        },
        {
            "rel": "self",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?limit=2&offset=2"
        }
    ],
    "items": [
        {
            "links": [
                {
                    "rel": "self",
                    "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/90"
                }
            ],
            "id": "90"
        }
    ],
    "count": 1,
    "offset": 2,
    "hasMore": false,
    "totalResults": 3
} 

          

Related Topics

General Notices