All Products
Search
Document Center

DataWorks:CreateQualityRule

Last Updated:Oct 17, 2024

Creates a monitoring rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
BlockTypeintegerYes

The strength type of the monitoring rule. Valid values: 0 and 1. The value 0 indicates that the monitoring rule is a weak rule. The value 1 indicates that the monitoring rule is a strong rule.

0
EntityIdlongYes

The ID of the partition filter expression.

15224
CommentstringNo

The description of the monitoring rule.

CheckerintegerYes

The checker ID.

9
ExpectValuestringNo

The expected value.

0
TrendstringNo

The trend of the monitoring result. Valid values:

  • up: increasing
  • down: decreasing
  • abs: absolute value
abs
MethodNamestringYes

The method used to collect sample data. If you want to use a custom SQL statement as a sampling method, set this parameter to user_defined.

count/table_count
OperatorstringNo

The comparison operator, such as >, >=, =, ≠, <, or <=.

Note If you set the Checker parameter to 9, you must configure the Operator parameter.
>
ProjectNamestringYes

The name of the compute engine or data source.

autotest
PropertystringNo

The fields that you want to monitor. If you want to monitor all fields in a table and check the table rows, set this parameter to table_count. If you want to monitor all fields in a table and check the table size, set this parameter to table_size.

table_id
PropertyTypestringNo

The data type of the fields that you want to monitor. If you want to monitor all fields in a table, set this parameter to table. If you want to monitor only a specific field, set this parameter to bigint.

bigint
RuleTypeintegerYes

The type of the monitoring rule. Valid values: 0, 1, and 2. The value 0 indicates that the monitoring rule is created by the system. The value 1 indicates that the monitoring rule is created by a user. The value 2 indicates that the monitoring rule is a workspace-level rule.

0
WhereConditionstringNo

The filter condition or custom SQL statement.

table_id>1
CriticalThresholdstringNo

The threshold for a critical alert. The threshold indicates the deviation of the monitoring 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, nodes are blocked.

20
WarningThresholdstringNo

The threshold for a warning alert. The threshold indicates the deviation of the monitoring result from the expected value. You can customize this threshold based on your business requirements.

10
TemplateIdintegerNo

The template ID.

7
RuleNamestringYes

The name of the monitoring rule.

1234
PredictTypeintegerYes

Specifies whether the monitoring rule is a dynamic threshold rule. Valid values: 0 and 2. The value 0 indicates that the monitoring rule is not a dynamic threshold rule. The value 2 indicates that the monitoring rule is a dynamic threshold rule.

0
ProjectIdlongYes

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

10000
TaskSettingstringNo

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

x=a,y=b

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

HttpStatusCodeinteger

The HTTP status code.

200
Datastring

The ID of the monitoring rule that you created.

12345
ErrorMessagestring

The error message.

You have no permission.
RequestIdstring

The request ID.

ecb967ec-c137-48****
ErrorCodestring

The error code.

401
Successboolean

Indicates whether the request was successful.

true

Examples

Sample success responses

JSONformat

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

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-15The request parameters of the API has changedView Change Details
2023-03-08The request parameters of the API has changedView Change Details