Newer Version Available
Query More Results
Returns the next set of results from a SOQL query using a query locator.
If the number of results from an initial SOQL query exceeds the 2,000 record limit, the response contains the first set of 2,000 results, a false value for done, and a query locator. Use this query locator in another request to retrieve the next set of 2,000 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.
- URI
- /services/data/vXX.X/query/query_locator
- Formats
- JSON, XML
- HTTP Method
- GET
- Authentication
- Authorization: Bearer token
- Parameters
-
Parameter Description query_locator 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. - Response body
- 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).
- Example response body
-
Resources for Executing SOQL Queries
- For an example of how to use the query locator see Execute a SOQL Query.
- For another option to change the batch size, see Query Options Header.
-
For more information on SOQL in general, see the SOQL and SOSL Reference.