All Products
Search
Document Center

DataWorks:CreateQualityRule

Last Updated:Mar 23, 2026

Call CreateQualityRule to create a Quality Rule.

Note

This API has been deprecated. We recommend migrating to dataworks-public(2024-05-18) - CreateDataQualityScan for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

BlockType

integer

Yes

The strength of the rule. Valid values:

  • 0: weak rule

  • 1: strong rule

0

EntityId

integer

Yes

The ID of the partition filter expression.

15224

Comment

string

No

The comments of the rule.

Verification

Checker

integer

No

The ID of the checker. Valid values:

  • 2: 7-day average fluctuation

  • 3: 30-day average fluctuation

  • 4: day-over-day comparison

  • 5: week-over-week comparison

  • 6: month-over-month comparison

  • 7: 7-day variance fluctuation

  • 8: 30-day variance fluctuation

  • 9: comparison with a fixed value

  • 10: fluctuation detection over 1, 7, and 30 days

  • 11: comparison with the previous cycle

9

ExpectValue

string

No

The expected value.

0

Trend

string

No

The trend of the check result. Valid values:

  • up: upward trend

  • down: downward trend

  • abs: absolute value

abs

MethodName

string

No

The check method. If you use a custom SQL statement, set this parameter to user_defined.

count/table_count

Operator

string

No

The comparison operator. Examples: >, >=, =, <>, <, and <=.

Note

If you set the Checker parameter to 9, you must specify the Operator parameter.

>

ProjectName

string

Yes

The name of the compute engine or data source.

autotest

Property

string

No

The field that is monitored by the rule. To perform a table-level check, set this parameter to table_count for the number of rows or table_size for the table size.

table_id

PropertyType

string

No

The data type of the field. For a table-level check, set this parameter to table. For a field-level check, set this parameter to a specific data type, such as bigint.

bigint

RuleType

integer

Yes

The type of the rule. Valid values:

  • 0: system template

  • 1: custom SQL

  • 2: custom template

0

WhereCondition

string

No

The filter condition or custom SQL statement.

table_id>1

CriticalThreshold

string

No

The critical threshold. It indicates the deviation of the check result from the expected value. You can customize this threshold based on your business requirements. If a strong rule is used and a critical alert is triggered, the scheduling task is blocked.

20

WarningThreshold

string

No

The warning threshold. It indicates the deviation of the check result from the expected value. You can customize this threshold based on your business requirements.

10

TemplateId

integer

No

The ID of the template.

7

RuleName

string

Yes

The name of the rule.

1234

PredictType

integer

Yes

Specifies whether to use a dynamic threshold. Valid values:

0

ProjectId

integer

Yes

The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace ID.

10000

TaskSetting

string

No

The variable settings that are inserted before the custom rule. Format: x=a,y=b.

x=a,y=b

Response elements

Element

Type

Description

Example

object

The response parameters.

HttpStatusCode

integer

The HTTP status code.

200

Data

string

The ID of the new rule.

12345

ErrorMessage

string

The error message.

You have no permission.

RequestId

string

The request ID.

ecb967ec-c137-48****

ErrorCode

string

The error code.

401

Success

boolean

Whether the request succeeded.

true

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "Data": "12345",
  "ErrorMessage": "You have no permission.",
  "RequestId": "ecb967ec-c137-48****",
  "ErrorCode": "401",
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.