Creates a new quality rule with the provided details. Returns a status message.
Request
Request body properties
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Name of the quality rule. Must be unique within the account. |
| description | string | No | Description of the rule. |
| dimensionName | string | Yes |
Specifies the data quality dimension the rule addresses
and how results are grouped and reported. Valid values:
|
| ruleType | string | No | Specifies the type of rule evaluation logic.
Supported values: Expression,
Sql. If not provided, the rule is
treated as Expression by default. |
| passCondition | object | Yes |
Defines the logic that determines whether a record passes the rule. This is the core rule logic evaluated by the rule engine. |
| passCondition.type | string | Yes |
Specifies the condition type. Interpreted based on
|
|
passCondition.config |
string | Yes |
Expression or SQL logic evaluated by the rule. Syntax
depends on |
| filterCondition | object | No | Optional pre-filter applied before rule evaluation. Records that do not match this condition are excluded from evaluation. |
| filterCondition.type | string | Conditional |
Specifies the filter condition type. Required if
|
| filterCondition.config | string | Conditional | Expression or SQL used to filter records before apply
the passCondition. |
| failedCondition | object | No |
Optional condition that explicitly defines failed records. Applicable for SQL rules and uses the same {type, config} structure as passCondition and filterCondition. |
| failedCondition.type | string | Conditional |
Specifies the failed‑condition type. Required if
|
| failedCondition.config | string | Conditional | Expression or SQL identifying failed records.
Evaluated based on ruleType. |
| isFailedCondition | boolean | No |
Indicates whether the failedCondition should be evaluated. For SQL rules, when failedCondition is provided, this value must be set to true. |
| captureFailedRecords | boolean | No |
When true, failed records are captured for inspection as part of rule results. |
| enableAutoRun | boolean | No |
Controls whether the rule is executed automatically based on system conditions. When true, the rule is automatically triggered based on system conditions. |
| targetingType | string | Yes |
Specifies the scope at which the rule is applied.
Determines whether the rule applies at the
|
|
targetAssetsFilter |
array<string> |
Yes |
Filter expressions used to select target assets for rule evaluation. Controls which assets the rule applies to. |
|
mappings |
array<object> |
Yes (if targetingType is |
Array of mapping objects that define how dataset columns
are mapped for rule evaluation. Required when
targetingType is
|
|
mappings[].datasetId |
string | Conditional |
Identifier of the dataset used by the rule. Required when mappings is provided. |
|
mappings[].columnMapping |
array<object> | Conditional |
Defines column‑level mappings used to bind rule logic to dataset columns during rule evaluation. Required when mappings is provided. |
|
mappings[].columnMapping[].columnName |
string | Conditional |
Name of the source dataset column referenced by the rule. |
|
mappings[].columnMapping[].dataType |
string | Conditional |
Data type of the column, used by the rule engine during evaluation. |
|
mappings[].columnMapping[].alias |
string | No |
Alias for the column used in expressions to simplify logic. |
|
mappings[].columnMapping[].targetField |
string |
No |
Target field name used internally by the rule engine for rule processing. |
Examples of valid rule conditions
The following examples illustrate valid rule conditions using Expression and SQL syntax. They demonstrate function usage and show how rule behavior defaults to Expression when ruleType is not specified.
Example 1 - Default Expression rule
ruleType is not specified, the rule is
treated as an Expression rule by default.
{
"name": "firstname_not_null",
"dimensionName": "Completeness",
"targetingType": "Field",
"targetAssetsFilter": [
"properties.CatalogType:eq(Field)"
],
"passCondition": {
"type": "Expression",
"config": "FIRSTNAME IS NOT NULL"
}
}{
"name": "recent_order_check",
"ruleType": "Expression",
"dimensionName": "Timeliness",
"targetingType": "Dataset",
"targetAssetsFilter": [
"properties.CatalogType:eq(Dataset)"
],
"passCondition": {
"type": "Expression",
"config": "ORDER_DATE >= TO_DATE('2024-01-01')"
}
}{
"name": "active_records_sql_rule",
"ruleType": "Sql",
"dimensionName": "Accuracy",
"targetingType": "Dataset",
"targetAssetsFilter": [
"properties.CatalogType:eq(Dataset)"
],
"passCondition": {
"type": "Sql",
"config": "SELECT * FROM input WHERE CREATED_TS >= TO_DATETIME('2024-01-01 00:00:00')"
}
}Request body property operators
Tables in this section describe operators to be used in specified request body property values.
targetingType value |
Catalog type | Filter | Operators |
|---|---|---|---|
Field |
Field |
|
|
Dataset |
Dataset |
|
|
FilterByCondition |
Datasource | filter = name |
|
| Datasource | filter = name |
|
|
| Dataset | filter = id |
|
|
| Dataset | filter = value |
|
|
| Semantic type | filter = qualifier |
|
|
| Semantic type | filter = value |
|
| For this operation | Use this operator |
|---|---|
| is | = |
| is not | != |
| is populated | IS NOT NULL |
| is not populated | IS NULL |
| Value in the array values | IN |
| is greater than | >= |
| is greater than or equal to | >= |
| is less than | <= |
| is less than or equals to | <= |
| Date | TO_DATE('YYYY-MM-DD'), for example TO_DATE('1990-12-07') |
| Time | TO_TIME('HH:MI:SS'), for example TO_TIME('11:25:31') |
| Date-time | TO_DATETIME('YYYY-MM-DD HH:MI:SS'), for example TO_DATETIME('1990-12-07 11:25:31') |
Request example
Example request body for this method is shown below. You can
create rules in three ways by setting the
targetingType property to
Field, Dataset, or
FieldByCondition.
{
"name": "rule_name",
"description": "rule_description",
"dimensionName": "dimension_name",
"targetAssetsFilter": [
"properties.CatalogType:eq(Field)&filter=id:eq(asset_id)"
],
"mappings": [
{
"datasetId": "dataset_id",
"columnMapping": [
{
"columnName": "column_name",
"dataType": "string",
"alias": "column_alias",
"targetField": "column_name"
}
]
}
],
"captureFailedRecords": true,
"enableAutoRun": true,
"targetingType": "Field",
"passCondition": {
"type": "script",
"config": "condition_expression"
},
"filterCondition": {
"type": "script",
"config": "filter_expression"
}
}{
"id": "rule_id",
"name": "rule_name",
"description": "rule_description",
"dimensionName": "dimension_name",
"passCondition": {
"type": "script",
"config": "condition_expression"
},
"captureFailedRecords": true,
"enableAutoRun": true,
"targetingType": "Dataset",
"targetAssetsFilter": [
"properties.CatalogType:eq(Dataset)&filter=id:eq(asset_id)"
],
"mappings": [
{
"datasetId": "dataset_id",
"columnMapping": [
{
"columnName": "column_name",
"dataType": "string",
"alias": "column_alias"
}
]
}
]
}{
"name": "rule_name",
"description": "rule_description",
"dimensionName": "dimension_name",
"targetAssetsFilter": [
"properties.CatalogType:eq(Datasource type)&filter=name:in(dataSource_type)",
"properties.CatalogType:eq(Datasource)&filter=displayValue:in(dataSource_name)",
"properties.CatalogType:eq(Dataset)&filter=displayValue:in(dataset_name)",
"properties.CatalogType:eq(Semantic type)&filter=qualifier:eq(semantic_name)"
],
"captureFailedRecords": true,
"enableAutoRun": true,
"targetingType": "FieldByCondition",
"passCondition": {
"type": "script",
"config": "condition_expression"
},
"filterCondition": {
"type": "script",
"config": "filter_expression"
}
}{
"name": "conditional_field_rule",
"description": "Apply rule to fields selected dynamically by conditions",
"dimensionName": "Accuracy",
"targetAssetsFilter": [
"properties.CatalogType:eq(Datasource)&filter=displayValue:in(dataSource_name)",
"properties.CatalogType:eq(Dataset)&filter=displayValue:in(dataset_name)"
],
"captureFailedRecords": true,
"enableAutoRun": true,
"targetingType": "FieldByCondition",
"passCondition": {
"type": "Expression",
"config": "VALUE IS NOT NULL"
},
"filterCondition": {
"type": "Expression",
"config": "STATUS = 'ACTIVE'"
}
}
Response
The successful response returns the unique identifier for the new quality rule.
Response example
Example status code responses for this method are shown here.
Rule created successfully.
{
"id":"693eed89aa5bb52e34cc61dd"
}{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "Invalid rule request - Rule must have a name present",
"instance": "/v1/quality/rules",
"errorCode": "DIS-QUALITY-RULES-USR-0006"
}{
"type": "about:blank",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred on the server",
"instance": "/v1/quality/rules",
"errorCode": "DIS-QUALITY-RULES-SVC-0001"
}