Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Query More Results

Returns the next batch of results from a SOQL query using a query locator.

If the number of results returned from a SOQL query exceeds the number of requested records or the limit, the response contains a batch of results, a false value for done, and a query locator. Use the query locator in another request to retrieve the next batch of records. If there are still more records to be returned, the response contains a new query locator and done is false. You can continue retrieving results from the initial query until done is true, which indicates that all results are returned.

The response contains the total number of records returned by the QueryAll request (totalSize), a boolean indicating whether there are no more results (done), the URI of the next set of records (nextRecordsUrl), and an array of query result records (records).

Syntax

URI: /services/data/vXX.X/query/queryLocator

Formats: JSON, XML

HTTP Method: GET

Authentication: Authorization: Bearer token

Parameters

Parameter Description
queryLocator A string used to retrieve the next set of query results. If there are more results to be retrieved, the previous set of query results contains the query locator in the nextRecordsUrl field.

Example

Example Response Body

1{
2  "totalSize": 3222,
3  "done": false,
4  "nextRecordsUrl": "/services/data/v67.0/query/01gRO0000016PIAYA2-500",
5  "records": [
6    {
7      "attributes": {
8        "type": "Contact",
9        "url": "/services/data/v67.0/sobjects/Contact/003RO0000035WQgYAM"
10      },
11      "Id": "003RO0000035WQgYAM",
12      "Name": "John Smith"
13    },
14    ...
15  ]
16}

Resources for Executing SOQL Queries