Creating a Rule Template
Function
This API is used to create a rule template.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/quality/rule-templates
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain it, see Project ID and Account ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
workspace |
Yes |
String |
DataArts Studio workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID. |
|
X-Auth-Token |
Yes |
String |
IAM token. For details about how to obtain the token, see Authentication. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Rule template ID |
|
name |
No |
String |
Rule template name |
|
directory_id |
No |
Long |
Directory ID |
|
dimension_id |
No |
Integer |
Dimension ID. Value 1 indicates completeness, 2 indicates uniqueness, 3 indicates timeliness, 4 indicates validity, 5 indicates accuracy, and 6 indicates consistency. |
|
description |
No |
String |
Description |
|
sql_info |
No |
String |
SQL content in the template |
|
result_description |
No |
String |
Result description |
|
publish |
No |
Boolean |
Whether the operation is a publish operation. Value true indicates publishing a new version, and false indicates saving the current version. |
|
origin_name |
No |
String |
Original template name |
|
abnormal_table_template |
No |
String |
Abnormal table template |
|
user_define_version_name |
No |
String |
User-defined version name |
|
version_num |
No |
Long |
Version number in the template information |
|
status |
No |
Integer |
Rule template status. Value 0 indicates offline, and 1 indicates published. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Long |
Rule template ID |
|
name |
String |
Rule template name |
|
category_id |
Long |
Catalog ID |
|
dimension |
String |
Dimension, which can be Completeness, Uniqueness, Timeliness, Validity, Accuracy, or Consistency |
|
type |
String |
Rule type. Field indicates a field rule, Table indicates a table rule, Database indicates a database rule, Cross-field indicates a cross-field rule, and Customize indicates a custom rule. |
|
system_template |
Boolean |
Whether the template is a system template |
|
sql_info |
String |
SQL information |
|
abnormal_table_template |
String |
Abnormal table template |
|
result_description |
String |
Result description |
|
create_time |
Long |
Creation time. The value is a 13-digit timestamp accurate to millisecond. |
|
creator |
String |
Creator. Value System indicates that the creator is provided by the system. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code, for example, DQC.0000 which indicates that the request was successfully processed |
|
error_msg |
String |
Error message |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code, for example, DQC.0000 which indicates that the request was successfully processed |
|
error_msg |
String |
Error message |
Example Requests
Create a rule template named test. The template ID is 0, directory ID is 0, dimension ID is 1, SQL content in the template is select count(*) from ${Schema_Table1}, release operation is false by default, result description is the total number of records, and description is test.
POST /v2/0833a5737480d53b2f25c010dc1a7b88/quality/rule-templates
{
"id" : "0",
"name" : "test",
"directory_id" : "0",
"dimension_id" : 1,
"description" : "test",
"sql_info" : "select count(*) from ${Schema_Table1}",
"result_description" : "Total number of records",
"publish" : false,
"origin_name" : null,
"abnormal_table_template" : "select count(*) from ${Schema_Table1}",
"user_define_version_name" : null,
"version_num" : null,
"status" : null
}
Example Responses
Status code: 200
Success
{
"id" : "1045431715138617345",
"name" : "test",
"category_id" : 0,
"dimension" : "Completeness",
"type" : "Table",
"system_template" : false,
"sql_info" : "select count(*) from ${Schema_Table1}",
"abnormal_table_template" : "select count(*) from ${Schema_Table1}",
"result_description" : "Number of records",
"create_time" : 1640678720014,
"creator" : "test"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Success |
|
400 |
BadRequest |
|
500 |
INTERNAL SERVER ERROR |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.