调用CreateQualityRule创建质量监控规则。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String CreateQualityRule

系统规定参数。取值:CreateQualityRule

BlockType Integer 0

规则的强弱:0表示弱规则,1表示强规则。

EntityId Long 15224

分区表达式的ID。

Comment String 验证

规则的描述信息。

Checker Integer 9

校验器的ID。

ExpectValue String 0

期望值。

Trend String abs

校验结果的趋势。取值如下:

  • up,表示上升趋势。
  • down,表示下降趋势。
  • abs,表示绝对值。
MethodName String count/table_count

采样方。如果是自定义SQL,该参数的值为user_defined。

Operator String >

比较符。

ProjectName String autotest

引擎或者数据源的名称。

Property String table_id

规则的字段。如果是表级别校验,行数为table_count、大小为table_size字段。

PropertyType String bigint

字段的类型,表级table,字段级填写bigint等。

RuleType Integer 0

规则的类型:0表示系统定义、1表示用户自定义、2表示项目级规则。

WhereCondition String table_id>1

过滤条件或自定义SQL。

CriticalThreshold String 20

红色告警阈值。表示与样本预期的偏离程度。您可以根据业务需求自定义该阈值。使用强规则并触发红色阈值,会阻塞调度任务。

WarningThreshold String 10

橙色告警阈值。表示与样本预期的偏离程度,您可以根据业务需求自定义该阈值。

TemplateId Integer 7

模板的ID。

RuleName String 1234

规则的名称。

PredictType Integer 0

是否为动态阈值:0表示非动态阈值、2表示动态阈值规则。

返回数据

名称 类型 示例值 描述
HttpStatusCode Integer 200

HTTP返回码。

Data String 12345

新建的规则ID。

ErrorMessage String You have no permission.

错误信息。

RequestId String ecb967ec-c137-48****

请求ID。

ErrorCode String 401

错误码。

Success Boolean true

调用是否成功。

示例

请求示例

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
&<公共请求参数>

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

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

错误码

访问错误中心查看更多错误码。