Asset Rule Preview
- Last UpdatedSep 08, 2023
- 8 minute read
Get Preview Results
Returns a AssetRulePreviewResult.
Request
GET /api/v1-preview/tenants/{tenantId}/namespaces/{namespaceId}/preview/assetrules
?token={token}&skip={skip}&count={count}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string token
A Guid which corresponds to a preview that has been created using the StartPreview method.integer skip
An Int32 to determine the number of preview results to skip.
[optional] integer count
An Int32 to determine the number of preview results to return.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | AssetRulePreviewResult | A AssetRulePreviewResult object. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 404 | ResponseBody | The specified preview was not found. |
| 500 | ResponseBody | Internal server error. |
Example response body
200 Response
{
"Status": "status",
"Assets": [
{
"AssetId": "assetId",
"ChangeType": "changeType",
"Asset": {
"Id": "id",
"AssetTypeId": "assetTypeId",
"Name": "name",
"Description": "description",
"Metadata": [
{
"Id": "id",
"Name": "name",
"Description": "description",
"SdsTypeCode": 18,
"Value": "value",
"Uom": "uom"
}
],
"StreamReferences": [
{
"Id": "id",
"Name": "name",
"Description": "description",
"StreamId": "streamId"
}
],
"Status": {
"Name": "name",
"Description": "description",
"StreamReferenceId": "streamReferenceId",
"StreamPropertyId": "streamPropertyId",
"ValueStatusMappings": [
{
"Value": "value",
"Status": 1,
"DisplayName": "displayName"
}
]
}
}
}
],
"Statistics": {
"Streams": 1,
"TotalResults": 1
}
}
400 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
403 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
404 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
500 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
Start Preview
Creates a RulePreviewResponse of a RuleModel object.
Request
POST /api/v1-preview/tenants/{tenantId}/namespaces/{namespaceId}/preview/assetrules
?KeepOldMetadata={KeepOldMetadata}&Skip={Skip}&Count={Count}&PageSize={PageSize}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.
[optional] boolean KeepOldMetadata
A Boolean to determine whether or not existing metadata created by the rule should be preserved if the rule were deleted.
Defaults to false.[optional] integer Skip
An Int32 to determine how many results to skip.[optional] integer Count
An Int32 to determine how many results to return.[optional] integer PageSize
Request Body
The RuleModel object to preview.
{
"Id": "ruleId",
"Name": "name",
"Description": "description",
"ExampleStreamId": "exampleId",
"AutomationId": "00000000-0000-0000-0000-000000000000",
"State": "Started",
"Expressions": [
{
"Field": "Id",
"Specification": [
{
"Type": "Wildcard",
"Name": "id"
}
]
}
],
"Outputs": [
{
"Field": "Metadata",
"Value": {
"key": "{id}"
}
}
],
"CreationTime": "0001-01-01T00:00:00",
"ModifiedTime": "0001-01-01T00:00:00",
"ErrorInfo": {
"ErrorCount": 2
}
}
Response
| Status Code | Body Type | Description |
|---|---|---|
| 202 | RulePreviewResponse | A RulePreviewResponse object. |
| 204 | ResponseBody | A RulePreviewResponse object. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 500 | ResponseBody | Internal server error. |
| 503 | ResponseBody | Dependent service error. |
Example response body
202 Response
{
"PreviewLink": "/api/v1-preview/tenants/{tenantId}/namespaces/{namespaceId}/preview/assetrules?Token=00000000-0000-0000-0000-000000000000",
"Expires": 7200
}
204 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
400 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
403 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
500 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
503 Response
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
Cancel Preview
Cancels a running preview.
Request
DELETE /api/v1-preview/tenants/{tenantId}/namespaces/{namespaceId}/preview/assetrules
?token={token}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string token
A Guid which corresponds to a preview that has been created using the StartPreview method.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 204 | None | No content. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 404 | ResponseBody | The specified preview was not found. |
| 500 | ResponseBody | Internal server error. |
Definitions
RulePreviewResponse
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| PreviewLink | string | false | true | None |
| Expires | int32 | false | false | None |
{
"PreviewLink": "string",
"Expires": 0
}
ResponseBody
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| OperationId | string | false | true | None |
| Error | string | false | true | None |
| Reason | string | false | true | None |
| Resolution | string | false | true | None |
| Parameters | object | false | true | None |
{
"OperationId": "00000000-0000-0000-0000-000000000000",
"Error": "Error message.",
"Reason": "Reason that caused the error.",
"Resolution": "Possible resolution for the error.",
"Parameters": {
"key1": "value1",
"key2": "value2"
}
}
RuleModel
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | None |
| Name | string | false | true | None |
| Description | string | false | true | None |
| ExampleStreamId | string | false | true | None |
| AutomationId | string | false | true | None |
| State | RuleStateEnum | false | false | None |
| Expressions | [RuleExpression] | false | true | None |
| Outputs | [RuleOutput] | false | true | None |
| CreationTime | date-time | false | false | None |
| ModifiedTime | date-time | false | false | None |
{
"Id": "ruleId",
"Name": "name",
"Description": "description",
"ExampleStreamId": "exampleId",
"AutomationId": "00000000-0000-0000-0000-000000000000",
"State": "Started",
"Expressions": [
{
"Field": "Id",
"Specification": [
{
"Type": "Wildcard",
"Name": "id"
}
]
}
],
"Outputs": [
{
"Field": "Metadata",
"Value": {
"key": "{id}"
}
}
],
"CreationTime": "0001-01-01T00:00:00",
"ModifiedTime": "0001-01-01T00:00:00",
"ErrorInfo": {
"ErrorCount": 2
}
}
RuleStateEnum
Enumerated Values
| Property | Value | Description |
|---|---|---|
| Started | 0 | |
| Stopped | 1 |
RuleExpression
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Field | string | false | true | None |
| Specifications | [Specification] | false | true | None |
{
"Field": "string",
"Specifications": [
{
"Type": 0,
"Value": "string",
"Name": "string",
"CharacterType": 0,
"CharacterLength": 0,
"StrictValueMappings": true,
"RequiredDelimiters": [
"string"
],
"ValueMappings": {
"property1": "string",
"property2": "string"
}
}
]
}
Specification
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Type | SpecificationType | false | false | None |
| Value | string | false | true | None |
| Name | string | false | true | None |
| CharacterType | CharacterType | false | false | None |
| CharacterLength | int32 | false | true | Null represents the longest string length within the group. |
| StrictValueMappings | boolean | false | false | None |
| RequiredDelimiters | string[] | false | true | None |
| ValueMappings | object | false | true | None |
{
"Type": 0,
"Value": "string",
"Name": "string",
"CharacterType": 0,
"CharacterLength": 0,
"StrictValueMappings": true,
"RequiredDelimiters": [
"string"
],
"ValueMappings": {
"property1": "string",
"property2": "string"
}
}
SpecificationType
Enumerated Values
| Property | Value |
|---|---|
| Unspecified | 0 |
| Group | 1 |
| Wildcard | 2 |
| Literal | 3 |
| Delimiter | 4 |
CharacterType
Enumerated Values
| Property | Value |
|---|---|
| Any | 0 |
| Letter | 1 |
| Digit | 2 |
| Alphanumeric | 3 |
RuleOutput
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Field | string | false | true | None |
| Value | any | false | true | None |
{
"Field": "string",
"Value": null
}
AssetRulePreviewResult
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Status | string | false | true | None |
| Assets | [AssetPreviewData] | false | true | None |
| Statistics | AssetRulePreviewStatistics | false | true | None |
| Errors | [RuleError] | false | true | None |
{
"Status": "status",
"Assets": [
{
"AssetId": "assetId",
"ChangeType": "changeType",
"Asset": {
"Id": "id",
"AssetTypeId": "assetTypeId",
"Name": "name",
"Description": "description",
"Metadata": [
{
"Id": "id",
"Name": "name",
"Description": "description",
"SdsTypeCode": 18,
"Value": "value",
"Uom": "uom"
}
],
"StreamReferences": [
{
"Id": "id",
"Name": "name",
"Description": "description",
"StreamId": "streamId"
}
],
"Status": {
"Name": "name",
"Description": "description",
"StreamReferenceId": "streamReferenceId",
"StreamPropertyId": "streamPropertyId",
"ValueStatusMappings": [
{
"Value": "value",
"Status": 1,
"DisplayName": "displayName"
}
]
}
}
}
],
"Statistics": {
"Streams": 1,
"TotalResults": 1
}
}
AssetPreviewData
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| AssetId | string | false | true | None |
| Streams | [SdsStreamModel] | false | true | None |
| Asset | Asset | false | true | None |
{
"AssetId": "string",
"Streams": [
{
"Id": "string",
"Name": "string",
"Description": "string",
"TypeId": "string"
}
],
"Asset": {
"Id": "string",
"AssetTypeId": "string",
"Name": "string",
"Description": "string",
"Metadata": [
{
"Id": "string",
"Name": "string",
"Description": "string",
"SdsTypeCode": 0,
"Value": null,
"Uom": "string"
}
],
"StreamReferences": [
{
"Id": "string",
"Name": "string",
"Description": "string",
"StreamId": "string"
}
],
"Status": {
"DefinitionType": 0,
"Definition": null
},
"Tags": [
"string"
]
}
}
SdsStreamModel
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | None |
| Name | string | false | true | None |
| Description | string | false | true | None |
| TypeId | string | false | true | None |
{
"Id": "string",
"Name": "string",
"Description": "string",
"TypeId": "string"
}
Asset
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | None |
| AssetTypeId | string | false | true | None |
| Name | string | false | true | None |
| Description | string | false | true | None |
| Metadata | [MetadataItem] | false | true | None |
| StreamReferences | [StreamReference] | false | true | None |
| Status | StatusConfiguration | false | true | None |
| Tags | string[] | false | true | None |
{
"Id": "string",
"AssetTypeId": "string",
"Name": "string",
"Description": "string",
"Metadata": [
{
"Id": "string",
"Name": "string",
"Description": "string",
"SdsTypeCode": 0,
"Value": null,
"Uom": "string"
}
],
"StreamReferences": [
{
"Id": "string",
"Name": "string",
"Description": "string",
"StreamId": "string"
}
],
"Status": {
"DefinitionType": 0,
"Definition": null
},
"Tags": [
"string"
]
}
MetadataItem
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | None |
| Name | string | false | true | None |
| Description | string | false | true | None |
| SdsTypeCode | SdsTypeCode | false | false | None |
| Value | any | false | true | None |
| Uom | string | false | true | None |
{
"Id": "string",
"Name": "string",
"Description": "string",
"SdsTypeCode": 0,
"Value": null,
"Uom": "string"
}
SdsTypeCode
Enumerated Values
| Property | Value |
|---|---|
| Empty | 0 |
| Object | 1 |
| Boolean | 3 |
| Char | 4 |
| SByte | 5 |
| Byte | 6 |
| Int16 | 7 |
| UInt16 | 8 |
| Int32 | 9 |
| UInt32 | 10 |
| Int64 | 11 |
| UInt64 | 12 |
| Single | 13 |
| Double | 14 |
| Decimal | 15 |
| DateTime | 16 |
| String | 18 |
| Guid | 19 |
| DateTimeOffset | 20 |
| TimeSpan | 21 |
| Version | 22 |
| NullableBoolean | 103 |
| NullableChar | 104 |
| NullableSByte | 105 |
| NullableByte | 106 |
| NullableInt16 | 107 |
| NullableUInt16 | 108 |
| NullableInt32 | 109 |
| NullableUInt32 | 110 |
| NullableInt64 | 111 |
| NullableUInt64 | 112 |
| NullableSingle | 113 |
| NullableDouble | 114 |
| NullableDecimal | 115 |
| NullableDateTime | 116 |
| NullableGuid | 119 |
| NullableDateTimeOffset | 120 |
| NullableTimeSpan | 121 |
| BooleanArray | 203 |
| CharArray | 204 |
| SByteArray | 205 |
| ByteArray | 206 |
| Int16Array | 207 |
| UInt16Array | 208 |
| Int32Array | 209 |
| UInt32Array | 210 |
| Int64Array | 211 |
| UInt64Array | 212 |
| SingleArray | 213 |
| DoubleArray | 214 |
| DecimalArray | 215 |
| DateTimeArray | 216 |
| StringArray | 218 |
| GuidArray | 219 |
| DateTimeOffsetArray | 220 |
| TimeSpanArray | 221 |
| VersionArray | 222 |
| Array | 400 |
| IList | 401 |
| IDictionary | 402 |
| IEnumerable | 403 |
| SdsType | 501 |
| SdsTypeProperty | 502 |
| SdsStreamView | 503 |
| SdsStreamViewProperty | 504 |
| SdsStreamViewMap | 505 |
| SdsStreamViewMapProperty | 506 |
| SdsStream | 507 |
| SdsStreamIndex | 508 |
| SdsTable | 509 |
| SdsColumn | 510 |
| SdsValues | 511 |
| SdsObject | 512 |
| SByteEnum | 605 |
| ByteEnum | 606 |
| Int16Enum | 607 |
| UInt16Enum | 608 |
| Int32Enum | 609 |
| UInt32Enum | 610 |
| Int64Enum | 611 |
| UInt64Enum | 612 |
| NullableSByteEnum | 705 |
| NullableByteEnum | 706 |
| NullableInt16Enum | 707 |
| NullableUInt16Enum | 708 |
| NullableInt32Enum | 709 |
| NullableUInt32Enum | 710 |
| NullableInt64Enum | 711 |
| NullableUInt64Enum | 712 |
StreamReference
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | None |
| Name | string | false | true | None |
| Description | string | false | true | None |
| StreamId | string | false | true | None |
{
"Id": "string",
"Name": "string",
"Description": "string",
"StreamId": "string"
}
StatusConfiguration
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| DefinitionType | StatusDefinitionType | false | false | None |
| Definition | any | false | true | None |
{
"DefinitionType": 0,
"Definition": null
}
StatusDefinitionType
Enumerated Values
| Property | Value |
|---|---|
| Unspecified | 0 |
| StreamPropertyMapping | 1 |
AssetRulePreviewStatistics
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| StreamsProcessed | int32 | false | false | Streams used in the preview. |
| TotalResults | int32 | false | false | Total number of asset results. |
| ExecutionErrors | int32 | false | false | Number of errors generted during execution |
| StreamsMatched | int32 | false | false | The streams that the rule applied to. |
| StreamReferences | int32 | false | false | The total number of stream references that assets have. |
| Metadatas | int32 | false | false | The total number of metadatas contained within the assets. |
| PercentDone | float | false | false | Percent of streams that have been processed from 0.0 to 1.0. |
{
"StreamsProcessed": 0,
"TotalResults": 0,
"ExecutionErrors": 0,
"StreamsMatched": 0,
"StreamReferences": 0,
"Metadatas": 0,
"PercentDone": 0
}
RuleError
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | guid | false | false | None |
| RuleId | string | false | true | None |
| TimeGenerated | date-time | false | false | None |
| ErrorDetails | string | false | true | None |
| ErrorMessageType | ErrorMessageType | false | false | None |
{
"Id": "00000000-0000-0000-0000-000000000000",
"RuleId": "ruleId",
"TimeGenerated": "0001-01-01T00:00:00",
"ErrorDetails": "Error details.",
"ErrorMessageType": 1
}
ErrorMessageType
Enumerated Values
| Property | Value |
|---|---|
| ConflictBetweenRules | 0 |
| CreateOrUpdate | 1 |
| Generic | 2 |
| AutomationId | 3 |
| ConflictBetweenStreams | 4 |
| MissingMappings | 5 |
| ConflictBetweenRuleAndUser | 6 |