Call CreateQualityRule to create a quality monitoring rule.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Required CreateQualityRule

The operation that you want to perform.

BlockType Integer Yes 0

Rule strength: 0 indicates weak rules and 1 indicates strong rules.

Checker Integer Yes 9

The ID of the Checker.

EntityId Long Yes 15224

The ID of the partition filter expression.

MethodName String Required count/table_count

The sampling party. If you select custom SQL, the value of this parameter is user_define.

PredictType Integer Yes 0

Dynamic threshold: 0 indicates a non-dynamic threshold, and 1 indicates a dynamic threshold rule.

ProjectName String Required autotest

The name of the database engine or data source.

RegionId String Required cn-shanghai

The ID of the region where your project resides.

RuleName String Required 1234

The name of the rule.

RuleType Integer Yes 0

The rule type. Valid values: 0, 1, and 2. A value of 0 indicates system-defined rules, a value of 1 indicates user-defined rules, and a value of 2 indicates project-specific rules.

Comment String No Verify the test result

The description of the rule.

ExpectValue String No 0

The expected value of the checker.

Trend String No abs

The trend of the expected value.

Operator String No >

The comparison operator.

Property String No table_id

The field of the rule. If a table-level check is performed, the number of rows is table_count and the size is the table_size field.

PropertyType String No bigint

The type of the field. Valid values: table level and bigint.

WhereCondition String No table_id>1

The filtering condition. Write an SQL SELECT statement to specify the filtering condition.

CriticalThreshold String No 20

The warning threshold.

WarningThreshold String No 10

The error threshold.

TemplateId Integer No 7

The ID of the launch template.

Response parameters

Parameter Type Example Description
Data String 12345

The ID of the rule.

ErrorCode String 401

The error code.

ErrorMessage String You have no permission.

The returned message.

HttpStatusCode Integer 200

The HTTP status code.

RequestId String ecb967ec-c137-48****

The ID of the request.

Success Boolean true

Indicates whether the call is successful.

Examples

Sample requests

http(s)://[Endpoint]/? Action=CreateQualityRule
&BlockType=0
&Checker=9
&EntityId=15224
&MethodName=count/table_count
&PredictType=0
&ProjectName=autotest
&RegionId=cn-shanghai
&RuleName=1234
&RuleType=0
&<Common request parameters>

Sample success responses

XML format

<RequestId>ecb967ec-c137-48****</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>1234</Data>
<ErrorCode>401</ErrorCode>
<ErrorMessage>You have no permission. </ErrorMessage>
<Success>true</Success>

JSON format

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

Errors

For a list of error codes, visit the API Error Center.