Retrieve

Retrieve query definitions that match a set of search criteria.

OrdinalTypeDescription
1JSON objectRequired. A JSON object that contains search criteria.

A simple search contains a single criterion. To perform a simple search, pass a JSON object that contains a Property, a SimpleOperator, and a Value. In some cases, such as when you search for a null value, you can omit the Value.

For example, a simple search can return all query definitions that were modified between January 1, 2025 and February 1, 2025, as shown in this code sample.

A complex search contains two criteria that are connected with AND or OR logic. To perform a complex search, pass a JSON object that contains a LeftOperand object, a LogicalOperator, and a RightOperand object.

The LeftOperand and RightOperand objects both contain the same content: a Property, a SimpleOperator, and a Value.

The value of LogicalOperator is either AND or OR, depending on the type of logic that you want to use to connect the two operands.

This sample shows a complex search that returns active query definitions where the name of the query definition begins with the phrase "LoyaltyRewards."

The Property contains the name of the field to perform the search in. For example, to search for query definitions based on their name, specify Name. This table lists several common properties.

PropertyTypeDescription
NameStringThe name of the query definition.
ObjectIDStringA unique ID for the query definition.
QueryTextStringThe SQL expression used in the query definition.
TargetTypeStringThe type of object that the query definition targets.
StatusStringThe status of the query definition.
DescriptionStringThe optional description of the query definition.
CreatedDateDatetimeThe date and time when the query definition was created.
ModifiedDateDatetimeThe date and time when the query definition was last modified.
CustomerKeyStringAn external identifier for the query definition.

For the SimpleOperator property, specify the comparison that you want to perform between the Property and the Value. This table lists the comparisons that you can perform.

OperatorDescription
betweenSearch for a value that’s between two specified values. For example, ID BETWEEN ["123456","987654"] searches for all ID values greater than or equal to 123456 and less than or equal to 987654.
equalsSearch for an exact match.
greaterThanSearch for a numeric value that’s greater than the specified value.
greaterThanOrEqualSearch for a numeric value that’s greater than or equal to the specified value.
inSearch for any of the values in a list that contains multiple values. For example ID IN {"123456","234567","345678"} searches for any ID values that are exactly 123456, 234567, or 345678.
isNotNullSearch for any non-null value.
isNullSearch for null values.
lessThanSearch for a numeric value that’s less than the specified value.
lessThanOrEqualSearch for a numeric value that’s less than or equal to the specified value.
likeSearch for a string that matches a specified pattern. This operator supports all Transact-SQL wildcard operators.
notEqualsSearch for any value that doesn’t exactly match the specified value.

For the Value property, specify the value that you want to search for. You can omit the Value property if the value of the SimpleOperator property is isNull or isNotNull.

This sample code retrieves all active query definitions.

The response is an array of objects. Each object in the array represents a query definition that meets the search criteria.