Retrieve
Retrieve query definitions that match a set of search criteria.
Ordinal | Type | Description |
---|---|---|
1 | JSON object | Required. 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.
Property | Type | Description |
---|---|---|
Name | String | The name of the query definition. |
ObjectID | String | A unique ID for the query definition. |
QueryText | String | The SQL expression used in the query definition. |
TargetType | String | The type of object that the query definition targets. |
Status | String | The status of the query definition. |
Description | String | The optional description of the query definition. |
CreatedDate | Datetime | The date and time when the query definition was created. |
ModifiedDate | Datetime | The date and time when the query definition was last modified. |
CustomerKey | String | An 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.
Operator | Description |
---|---|
between | Search 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. |
equals | Search for an exact match. |
greaterThan | Search for a numeric value that’s greater than the specified value. |
greaterThanOrEqual | Search for a numeric value that’s greater than or equal to the specified value. |
in | Search 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. |
isNotNull | Search for any non-null value. |
isNull | Search for null values. |
lessThan | Search for a numeric value that’s less than the specified value. |
lessThanOrEqual | Search for a numeric value that’s less than or equal to the specified value. |
like | Search for a string that matches a specified pattern. This operator supports all Transact-SQL wildcard operators. |
notEquals | Search 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.