Create Rules - Create Rules
为数据产品和业务领域内的特定数据资产创建规则。
PUT {endpoint}/purviewdataquality/api/business-domains/{businessDomainId}/data-products/{dataProductId}/data-assets/{dataAssetId}/rules/{ruleId}?api-version=2026-01-12-preview
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
business
|
path | True |
string |
包含数据产品的业务域的唯一标识符 |
|
data
|
path | True |
string |
数据资产的唯一标识符 |
|
data
|
path | True |
string |
包含数据资产的数据产品的唯一标识符 |
|
endpoint
|
path | True |
string (uri) |
|
|
rule
|
path | True |
string |
规则的唯一标识符 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| id | True |
string |
唯一规则标识符 |
| name | True |
string |
规则的描述性名称 |
| status | True |
string |
当前执行状态 |
| type | True |
string |
规则类型分类 |
| businessDomain |
商业领域引用 |
||
| createdAt |
string (date-time) |
该规则创建的时间戳 |
|
| createdBy |
string |
规则创建者的用户标识 |
|
| dataAsset |
数据资产参考 |
||
| dataProduct |
数据产品参考 |
||
| description |
string |
规则验证和业务目的的详细描述 |
|
| dimension |
string |
可选业务维度或分类 |
|
| lastModifiedAt |
string (date-time) |
该规则最后修改的时间戳 |
|
| lastModifiedBy |
string |
规则最后一个修饰符的用户标识符 |
|
| score |
number (double) |
质量评分(0.0至1.0) |
|
| typeProperties |
类型特定的配置属性 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 201 Created |
请求已成功,因此创建了一个新资源。 |
|
| Other Status Codes |
意外错误响应。 标头 x-ms-error-code: string |
安全性
OAuth2Auth
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| https://purview.azure.net/.default |
示例
CreateRules_DataAsset
示例请求
PUT {endpoint}/purviewdataquality/api/business-domains/abcdef12-3456-7890-abcd-ef1234567890/data-products/12345678-abcd-1234-ef00-123456abcdef/data-assets/abcd1234-5678-abcd-1234-abcd5678ef00/rules/rule-1234-5678-abcd-ef00-123456abcdef?api-version=2026-01-12-preview
{
"id": "06dda07d-126b-43c1-aade-2484b265a271",
"name": "Custom",
"description": "",
"type": "CustomTruth",
"status": "Active",
"typeProperties": {
"condition": "{REVENUE} > 50000",
"filterCriteria": "{REGION} == 'India'",
"emptyCriteria": "{REVENUE_TARGET} < 100000",
"columns": [
{
"value": "REVENUE",
"type": "Column"
},
{
"value": "REGION",
"type": "Column"
},
{
"value": "REVENUE_TARGET",
"type": "Column"
}
]
},
"dimension": "Accuracy",
"businessDomain": {
"referenceId": "76be16f9-5cb3-4839-83d6-4e3829a8ab0c",
"type": "BusinessDomainReference"
},
"dataProduct": {
"referenceId": "2a1d2087-09e2-4ecf-817d-1f5bfcbc31bf",
"type": "DataProductReference"
},
"dataAsset": {
"referenceId": "fadb55b6-aa10-47d5-82c4-5e2723ba7869",
"type": "DataAssetReference"
}
}
示例响应
{
"name": "Custom",
"description": "",
"type": "CustomTruth",
"status": "Active",
"typeProperties": {
"condition": "{REVENUE} > 50000",
"filterCriteria": "{REGION} == 'India'",
"emptyCriteria": "{REVENUE_TARGET} < 100000",
"columns": [
{
"value": "REVENUE",
"type": "Column"
},
{
"value": "REGION",
"type": "Column"
},
{
"value": "REVENUE_TARGET",
"type": "Column"
}
]
},
"dimension": "Accuracy",
"id": "06dda07d-126b-43c1-aade-2484b265a271",
"businessDomain": {
"type": "BusinessDomainReference",
"referenceId": "76be16f9-5cb3-4839-83d6-4e3829a8ab0c"
},
"dataProduct": {
"type": "DataProductReference",
"referenceId": "2a1d2087-09e2-4ecf-817d-1f5bfcbc31bf"
},
"dataAsset": {
"type": "DataAssetReference",
"referenceId": "fadb55b6-aa10-47d5-82c4-5e2723ba7869"
},
"score": -1,
"createdAt": "2025-11-13T09:08:28.1798306Z",
"lastModifiedAt": "2025-11-13T09:08:29.1508867Z",
"createdBy": "6f19d772-4716-4523-9910-cb1575512ce6",
"lastModifiedBy": "6f19d772-4716-4523-9910-cb1575512ce6"
}
定义
| 名称 | 说明 |
|---|---|
|
Azure. |
错误对象。 |
|
Azure. |
包含错误详细信息的响应。 |
|
Azure. |
包含有关错误的更具体信息的对象。 根据 Azure REST API 指南 - https://aka.ms/AzureRestApiGuidelines#handling-errors。 |
| Column |
用于数据集验证和质量检查的列定义 |
| Reference |
数据治理层级中对关系建立的实体的引用 |
|
Rule |
数据质量规则实体,包含验证逻辑、执行参数和评分 |
|
Type |
数据质量规则的类型特定配置属性。 |
Azure.Core.Foundations.Error
错误对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| details |
导致此报告错误的特定错误的详细信息数组。 |
|
| innererror |
包含与当前对象有关错误的更具体信息的对象。 |
|
| message |
string |
有关错误的可读的表示形式。 |
| target |
string |
错误的目标。 |
Azure.Core.Foundations.ErrorResponse
包含错误详细信息的响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
Azure.Core.Foundations.InnerError
包含有关错误的更具体信息的对象。 根据 Azure REST API 指南 - https://aka.ms/AzureRestApiGuidelines#handling-errors。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| innererror |
内部错误。 |
Column
用于数据集验证和质量检查的列定义
| 名称 | 类型 | 说明 |
|---|---|---|
| type |
string |
列数据类型或分类 |
| value |
string |
列名或标识符 |
Reference
数据治理层级中对关系建立的实体的引用
| 名称 | 类型 | 说明 |
|---|---|---|
| referenceId |
string |
被引用实体的唯一标识符 |
| type |
string |
被引用实体的类型分类 |
RuleEntity
数据质量规则实体,包含验证逻辑、执行参数和评分
| 名称 | 类型 | 说明 |
|---|---|---|
| businessDomain |
商业领域引用 |
|
| createdAt |
string (date-time) |
该规则创建的时间戳 |
| createdBy |
string |
规则创建者的用户标识 |
| dataAsset |
数据资产参考 |
|
| dataProduct |
数据产品参考 |
|
| description |
string |
规则验证和业务目的的详细描述 |
| dimension |
string |
可选业务维度或分类 |
| id |
string |
唯一规则标识符 |
| lastModifiedAt |
string (date-time) |
该规则最后修改的时间戳 |
| lastModifiedBy |
string |
规则最后一个修饰符的用户标识符 |
| name |
string |
规则的描述性名称 |
| score |
number (double) |
质量评分(0.0至1.0) |
| status |
string |
当前执行状态 |
| type |
string |
规则类型分类 |
| typeProperties |
类型特定的配置属性 |
TypeProperties
数据质量规则的类型特定配置属性。
| 名称 | 类型 | 说明 |
|---|---|---|
| column |
列特定规则的列规范。 |
|
| columns |
Column[] |
多列或关系规则(如 Duplicate、CustomTruth)列列表。 |
| condition |
string |
主要逻辑条件或定义验证标准的表达式。 |
| emptyCriteria |
string |
可选条件,定义字段或列何时被视为空。 |
| filterCriteria |
string |
可选的过滤条件用于限制被该规则验证的行。 |
| pattern |
string |
格式规则的正则表达式或基于模式的验证逻辑。 |