Retrieve Batch Data with Query V2

Returns the next batch of data from the initial POST request.

A newer version of the Query API is available. We recommend using the newest Query API.

Note

Syntax 

  • HTTP Method: GET
  • Availability: Data 360 v2.0, Salesforce 54.0
  • format: REST
  • URI: /api/v2/query/{nextBatchId}

Path Parameters 

ParameterTypeDescription
nextBatchIdstringRequired. The batch identifier returned from the previous query response. Example: 09151b49-54ed-4948-8139-1f4c7c3a9581

Response Structure 

The response includes:

  • data: Array of record objects containing the requested data
  • startTime: ISO 8601 timestamp indicating when the query started executing
  • endTime: ISO 8601 timestamp indicating when the query finished executing
  • rowCount: Number of rows returned by the query
  • queryId: Unique identifier for the query
  • nextBatchId: Identifier for the next batch of results
  • done: boolean indicating if all results have been returned
  • metadata: Object containing metadata about the fields in the result set

Metadata Object 

The metadata object contains information about each field on the result set:

Field NameField TypeDescription
typestringSQL data type of the field
placeInOrderintegerPosition of the field on the result set
typeCodeintegerNumeric code representing the SQL data type

Examples 

Request 

1GET https://{TSE}.360a.salesforce.com/api/v2/query/09151b49-54ed-4948-8139-1f4c7c3a9581
2Authorization: Bearer {{cdpAuthToken}}

Response 

1{
2  "data": [["1103658353", "123", "2020-09-28T00:00:00.000+00:00"]],
3  "startTime": "2024-05-08T13:30:31.241168Z",
4  "endTime": "2024-05-08T13:30:35.571609Z",
5  "rowCount": 1,
6  "queryId": "20240508_133031_00088_p25a7",
7  "nextBatchId": "09151b49-54ed-4948-8139-1f4c7c3a9581",
8  "done": false,
9  "metadata": {
10    "state__c": {
11      "type": "VARCHAR",
12      "placeInOrder": 28,
13      "typeCode": 12
14    },
15    "sales__c": {
16      "type": "DECIMAL",
17      "placeInOrder": 23,
18      "typeCode": 3
19    },
20    "productid__c": {
21      "type": "VARCHAR",
22      "placeInOrder": 17,
23      "typeCode": 12
24    }
25  }
26}

Notes 

  • Use the done flag to determine if more results are available
  • When done is false, use the nextBatchId to retrieve the next set of records
  • All queries are executed synchronously
  • The API supports cursor-based pagination via nextBatchId
  • You must fetch the complete result set within one hour
  • The time interval between batch calls must not exceed three minutes

Related Resources