CdpQuery Class

Get Data Cloud metadata and query data.

Namespace

ConnectApi

CdpQuery Methods

These methods are for CdpQuery. All methods are static.

getAllMetadata()

Get all metadata, including Calculated Insights, Engagement, Profile, and other objects, as well as their relationships to other objects.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryMetadataOutput getAllMetadata()

getAllMetadata(entityType, entityCategory, entityName)

Get all metadata, filtering for entity type, category, and name.

API Version

54.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryMetadataOutput getAllMetadata(String entityType, String entityCategory, String entityName)

Parameters

entityType
Type: String
Type of metadata entity requested. Valid values are DataLakeObject, DataModelObject, and CalculatedInsight. If unspecified, all types are returned.
entityCategory
Type: String
Category of the metadata entity. Valid values are Profile, Engagement, and Related. If unspecified, all category entities are returned.
entityName
Type: String
Metadata name of the entity, for example UnifiedIndividual__dlm. If unspecified, a complete list of entities is returned.

getInsightsMetadata()

Get Insight metadata, including Calculated Insight objects, their dimensions and measures.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryMetadataOutput getInsightsMetadata()

getInsightsMetadata(ciName)

Get metadata for a Calculated Insight object. Metadata includes dimensions and measures.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryMetadataOutput getInsightsMetadata(String ciName)

Parameters

ciName
Type: String
Name of the Calculated Insight object, for example, IndividualChildrenCount__cio.

getProfileMetadata()

Get metadata for data model objects in the profile category, including Individual, Contact Point Email, Unified Individual, and Contact Point Address objects. Metadata includes the objects, their fields, and category.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryMetadataOutput getProfileMetadata()

getProfileMetadata(dataModelName)

Get metadata for a data model object in the profile category, such as Individual, Contact Point Email, Unified Individual, and Contact Point Address. Metadata includes the list of fields, data types, and indexes available for lookup.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryMetadataOutput getProfileMetadata(String dataModelName)

Parameters

dataModelName
Type: String
Name of the data model object, for example, UnifiedIndividual__dlm.

nextBatchAnsiSqlV2(nextBatchId)

Get the next batch of data across data model, lake, unified, and linked objects.

API Version

54.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutputV2 nextBatchAnsiSqlV2(String nextBatchId)

Parameters

nextBatchId
Type: String
ID of the next batch. See the Usage section for more information.

Return Value

Type: ConnectApi.CdpQueryOutputV2

Usage

Initially, use the queryAnsiSqlV2(input) method to query up to 8 MB of data. Use the nextBatchId from the ConnectApi.CdpQueryOutputV2 output class as the nextBatchId parameter in this method to get the next batch of data. You can continue using subsequent next batch IDs for up to an hour.

queryANSISql(input)

Synchronously query data across data model, lake, unified, and linked objects. This query returns up to 4,999 rows.

A newer version of the Query API is available. We recommend using queryAnsiSqlV2(input) and nextBatchAnsiSqlV2(nextBatchId) to take advantage of subsequent requests and larger response sizes.

Note

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryANSISql(ConnectApi.CdpQueryInput input)

Parameters

input
Type: ConnectApi.CdpQueryInput
A ConnectApi.CdpQueryInput body with the SQL query.

Return Value

Type: ConnectApi.CdpQueryOutput

queryANSISql(input, batchSize, offset, orderby)

Synchronously query data across data model, lake, unified, and linked objects. Specify batch size, offset, and order of the results. This query returns up to 4,999 rows.

A newer version of the Query API is available. We recommend using queryAnsiSqlV2(input) and nextBatchAnsiSqlV2(nextBatchId) to take advantage of subsequent requests and larger response sizes.

Note

API Version

53.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryANSISql(ConnectApi.CdpQueryInput input, Integer batchSize, Integer offset, String orderby)

Parameters

input
Type: ConnectApi.CdpQueryInput
A ConnectApi.CdpQueryInput body with the SQL query.
batchSize
Type: Integer
Number of records to return. Values are from 1–4999. The default value is 4999.
offset
Type: Integer
Number of rows to skip before returning results. The sum of offset and batchSize must be less than 2147483647. The default value is 0.
orderby
Type: String
Comma-separated values to sort the results in ascending or descending order, for example, GenderId__c ASC,Occupation__c DESC.

Return Value

Type: ConnectApi.CdpQueryOutput

queryAnsiSqlV2(input)

Query up to 8 MB of data across data model, lake, unified, and linked objects.

API Version

54.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutputV2 queryAnsiSqlV2(ConnectApi.CdpQueryInput input)

Parameters

input
Type: ConnectApi.CdpQueryInput
A ConnectApi.CdpQueryInput body with the SQL query.

Return Value

Type: ConnectApi.CdpQueryOutputV2

Usage

Use the nextBatchId in the ConnectApi.CdpQueryOutputV2 output class as the nextBatchId parameter in the nextBatchAnsiSqlV2(nextBatchId) method to continue getting batches of data for up to an hour.

queryCalculatedInsights(ciName, dimensions, measures, orderby, filters, batchSize, offset)

Query a Calculated Insight object.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryCalculatedInsights(String ciName, String dimensions, String measures, String orderby, String filters, Integer batchSize, Integer offset)

Parameters

ciName
Type: String
Name of the Calculated Insight object, for example, IndividualChildrenCount__cio.
dimensions
Type: String
Comma-separated list of up to 10 dimensions, such as GenderId__c, to project. If unspecified, this parameter includes all of the available dimensions.
measures
Type: String
Comma-separated list of up to 5 measures, such as TotalSales__c, to project. If unspecified, this parameter includes all of the available measures.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.
filters
Type: String
Filter the result set to a more narrow scope or specific type, such as [GenderId__c=Male,​FirstName__c=Angel].
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 4999.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.

Return Value

Type: ConnectApi.CdpQueryOutput

queryCalculatedInsights(ciName, dimensions, measures, orderby, filters, batchSize, offset, timeGranularity)

Query a Calculated Insight object within a specified time range.

API Version

54.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryCalculatedInsights(String ciName, String dimensions, String measures, String orderby, String filters, Integer batchSize, Integer offset, String timeGranularity)

Parameters

ciName
Type: String
Name of the Calculated Insight object, for example, IndividualChildrenCount__cio.
dimensions
Type: String
Comma-separated list of up to 10 dimensions, such as GenderId__c, to project. If unspecified, this parameter includes all of the available dimensions.
measures
Type: String
Comma-separated list of up to 5 measures, such as TotalSales__c, to project. If unspecified, this parameter includes all of the available measures.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.
filters
Type: String
Filter the result set to a more narrow scope or specific type, such as [GenderId__c=Male,​FirstName__c=Angel].
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 4999.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.
timeGranularity
Type: String
Time range for the measures. Values are:
  • HOUR
  • DAY
  • MONTH
  • QUARTER
  • YEAR
If unspecified, no time range is applied.

Return Value

Type: ConnectApi.CdpQueryOutput

queryProfileApi(dataModelName, filters, fields, batchSize, offset, orderby)

Query a Profile data model object using filters.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryProfileApi(String dataModelName, String filters, String fields, Integer batchSize, Integer offset, String orderby)

Parameters

dataModelName
Type: String
Name of the data model object, for example, UnifiedIndividual__dlm.
filters
Type: String
Comma-separated list of equality expressions within square brackets, for example, [FirstName__c=DON].
fields
Type: String
Comma-separated list of up to 50 field names that you want to include in the result, for example, Id__c,FirstName__c,​GenderId__c,Occupation__c. If unspecified, Id__c is returned.
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 100.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.

Return Value

Type: ConnectApi.CdpQueryOutput

queryProfileApi(dataModelName, id, searchKey, filters, fields, batchSize, offset, orderby)

Query a Profile data model object using filters and a search key.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryProfileApi(String dataModelName, String id, String searchKey, String filters, String fields, Integer batchSize, Integer offset, String orderby)

Parameters

dataModelName
Type: String
Name of the data model object, for example, UnifiedIndividual__dlm.
id
Type: String
Value of the primary or secondary key field, for example, John. If unspecified, defaults to the value of the primary key field.
searchKey
Type: String
If a field other than the primary key is used, name of the key field, for example, FirstName__c.
filters
Type: String
Comma-separated list of equality expressions within square brackets, for example, [FirstName__c=DON].
fields
Type: String
Comma-separated list of up to 50 field names that you want to include in the result, for example, Id__c,FirstName__c,​GenderId__c,Occupation__c. If unspecified, Id__c is returned.
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 100.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.

Return Value

Type: ConnectApi.CdpQueryOutput

queryProfileApi(dataModelName, id, childDataModelName, searchKey, filters, fields, batchSize, offset, orderby)

Query a Profile data model object and a child object using filters and a search key.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryProfileApi(String dataModelName, String id, String childDataModelName, String searchKey, String filters, String fields, Integer batchSize, Integer offset, String orderby)

Parameters

dataModelName
Type: String
Name of the data model object, for example, UnifiedIndividual__dlm.
id
Type: String
Value of the primary or secondary key field, for example, John. If unspecified, defaults to the value of the primary key field.
childDataModelName
Type: String
Name of the child data model object, for example, UnifiedContactPointEmail__dlm.
searchKey
Type: String
If a field other than the primary key is used, name of the key field, for example, FirstName__c.
filters
Type: String
Comma-separated list of equality expressions within square brackets, for example, [FirstName__c=DON]. Filters are applied to the parent object only.
fields
Type: String
Comma-separated list of child object field names that you want to include in the result, for example, Id__c,EmailAddress__c. If unspecified, the first 10 alphabetically sorted fields are returned.
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 100.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.

Return Value

Type: ConnectApi.CdpQueryOutput

queryProfileApi(dataModelName, id, ciName, searchKey, dimensions, measures, filters, fields, batchSize, offset, orderby)

Query a Profile data model object and a Calculated Insight object using filters and a search key.

API Version

52.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryProfileApi(String dataModelName, String id, String ciName, String searchKey, String dimensions, String measures, String filters, String fields, Integer batchSize, Integer offset, String orderby)

Parameters

dataModelName
Type: String
Name of the data model object, for example, UnifiedIndividual__dlm.
id
Type: String
Value of the primary or secondary key field, for example, John. If unspecified, defaults to the value of the primary key field.
ciName
Type: String
Name of the Calculated Insight object, for example, IndividualChildrenCount__cio.
searchKey
Type: String
If a field other than the primary key is used, name of the key field, for example, FirstName__c.
dimensions
Type: String
Comma-separated list of up to 10 dimensions, such as GenderId__c, to project. If unspecified, this parameter includes all of the available dimensions.
measures
Type: String
Comma-separated list of up to 5 measures, such as TotalSales__c, to project. If unspecified, this parameter includes all of the available measures.
filters
Type: String
Comma-separated list of equality expressions within square brackets, for example, [FirstName__c=DON].
fields
Type: String
Comma-separated list of up to 50 field names that you want to include in the result, for example, Id__c,FirstName__c,​GenderId__c,Occupation__c. If unspecified, Id__c is returned.
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 100.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.

Return Value

Type: ConnectApi.CdpQueryOutput

queryProfileApi(dataModelName, id, ciName, searchKey, dimensions, measures, filters, fields, batchSize, offset, orderby, timeGranularity)

Query a Profile data model object and a Calculated Insight object using filters, a search key, and a time range.

API Version

54.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryOutput queryProfileApi(String dataModelName, String id, String ciName, String searchKey, String dimensions, String measures, String filters, String fields, Integer batchSize, Integer offset, String orderby, String timeGranularity)

Parameters

dataModelName
Type: String
Name of the data model object, for example, UnifiedIndividual__dlm.
id
Type: String
Value of the primary or secondary key field, for example, John. If unspecified, defaults to the value of the primary key field.
ciName
Type: String
Name of the Calculated Insight object, for example, IndividualChildrenCount__cio.
searchKey
Type: String
If a field other than the primary key is used, name of the key field, for example, FirstName__c.
dimensions
Type: String
Comma-separated list of up to 10 dimensions, such as GenderId__c, to project. If unspecified, this parameter includes all of the available dimensions.
measures
Type: String
Comma-separated list of up to 5 measures, such as TotalSales__c, to project. If unspecified, this parameter includes all of the available measures.
filters
Type: String
Comma-separated list of equality expressions within square brackets, for example, [FirstName__c=DON].
fields
Type: String
Comma-separated list of up to 50 field names that you want to include in the result, for example, Id__c,FirstName__c,​GenderId__c,Occupation__c. If unspecified, Id__c is returned.
batchSize
Type: Integer
Number of items to return. Values are from 1–4,999. If unspecified, the default value is 100.
offset
Type: Integer
Number of rows to skip before returning results. If unspecified, no rows are skipped.
orderby
Type: String
Sort order for the result set, such as GenderId__c ASC,​Occupation__c DESC. If unspecified, items are returned in the order they are retrieved.
timeGranularity
Type: String
Time range for the measures. Values are:
  • HOUR
  • DAY
  • MONTH
  • QUARTER
  • YEAR
If unspecified, no time range is applied.

Return Value

Type: ConnectApi.CdpQueryOutput

universalIdLookupBySourceId(entityName, dataSourceId, dataSourceObjectId, sourceRecordId)

Look up objects by source ID.

API Version

54.0

Requires Chatter

No

Signature

public static ConnectApi.CdpQueryDataOutput universalIdLookupBySourceId(String entityName, String dataSourceId, String dataSourceObjectId, String sourceRecordId)

Parameters

entityName
Type: String
Entity name.
dataSourceId
Type: String
Data source ID.
dataSourceObjectId
Type: String
Data source object ID.
sourceRecordId
Type: String
Source record ID.

Return Value

Type: ConnectApi.CdpQueryDataOutput