Asset Rules
- Last UpdatedJul 28, 2022
- 10 minute read
List Rules
Returns all RuleModel objects from the IRuleStore to which the requesting Identity has access.
Request
GET /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules
?Skip={Skip}&Count={Count}&KeepOldMetadata={KeepOldMetadata}&KeepOldAssets={KeepOldAssets}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.
[optional] integer Skip
An Int32 to determine how many results to skip. Defaults to DefaultSkip[optional] integer Count
An Int32 to determine how many results to return. Defaults to DefaultCount[optional] boolean KeepOldMetadata
A Boolean to determine whether or not existing metadata created by the rule should be preserved if the rule were deleted. Only valid for metadata rule delete requests.
Defaults to false.[optional] boolean KeepOldAssets
A Boolean to determine whether or not existing assets created by the rule should be kept. Only valid for asset rule delete requests.
Defaults to false.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | RuleModel[] | The RuleModel objects. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 500 | ResponseBody | Internal server error. |
Example response body
200 Response
[
{
"Id": "ruleId",
"Name": "name",
"Description": "description",
"AutomationId": "00000000-0000-0000-0000-000000000000",
"State": "Started",
"Expressions": [
{
"Field": "Id",
"Specifications": [
{
"Type": "Group",
"Name": "streamId"
}
]
}
],
"Outputs": [
{
"Field": "Asset",
"Value": {
"Id": "assetId",
"Name": "name",
"AssetTypeId": "TypeId",
"Description": "description",
"Metadata": [
{
"Id": "metadataId",
"Name": "name",
"Description": "description",
"SdsTypeCode": "18",
"Value": "{streamId}"
}
],
"StreamReferences": [
{
"Id": "StreamRefId",
"Description": "description",
"StreamId": "{streamId}"
}
],
"Status": {
"StreamReferenceId": "StreamRefId",
"StreamPropertyId": "Value",
"ValueStatusMappings": [
{
"Value": "value",
"Status": 1,
"DisplayName": "Display Name Indicator"
}
]
}
}
}
],
"CreationTime": "0001-01-01T00:00:00",
"ModifiedTime": "0001-01-01T00:00:00",
"ErrorInfo": {
"ErrorCount": 0
}
}
]
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"
}
}
Create Rule With Server Generated Id
Creates a RuleModel object with a server generated Id in the IRuleStore.
Request
POST /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.
Request Body
The RuleModel object to create.
{
"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 |
|---|---|---|
| 201 | RuleModel | A link to the RuleModel object. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 409 | ResponseBody | A non-equivalent rule with the same identifier already exists. |
| 500 | ResponseBody | Internal server error. |
Example response body
201 Response
{
"Id": "ruleId",
"Name": "name",
"Description": "description",
"AutomationId": "00000000-0000-0000-0000-000000000000",
"State": "Started",
"Expressions": [
{
"Field": "Id",
"Specifications": [
{
"Type": "Group",
"Name": "streamId"
}
]
}
],
"Outputs": [
{
"Field": "Asset",
"Value": {
"Id": "assetId",
"Name": "name",
"AssetTypeId": "TypeId",
"Description": "description",
"Metadata": [
{
"Id": "metadataId",
"Name": "name",
"Description": "description",
"SdsTypeCode": "18",
"Value": "{streamId}"
}
],
"StreamReferences": [
{
"Id": "StreamRefId",
"Description": "description",
"StreamId": "{streamId}"
}
],
"Status": {
"StreamReferenceId": "StreamRefId",
"StreamPropertyId": "Value",
"ValueStatusMappings": [
{
"Value": "value",
"Status": 1,
"DisplayName": "Display Name Indicator"
}
]
}
}
}
],
"CreationTime": "0001-01-01T00:00:00",
"ModifiedTime": "0001-01-01T00:00:00",
"ErrorInfo": {
"ErrorCount": 0
}
}
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"
}
}
409 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"
}
}
Get Rule
Returns the specified rule.
Request
GET /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules/{ruleId}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string ruleId
Rule identifier.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | RuleModel | The specified rule. |
| 403 | ResponseBody | Forbidden. |
| 404 | ResponseBody | The specified rule was not found. |
| 500 | ResponseBody | Internal server error. |
Example response body
200 Response
{
"Id": "ruleId",
"Name": "name",
"Description": "description",
"AutomationId": "00000000-0000-0000-0000-000000000000",
"State": "Started",
"Expressions": [
{
"Field": "Id",
"Specifications": [
{
"Type": "Group",
"Name": "streamId"
}
]
}
],
"Outputs": [
{
"Field": "Asset",
"Value": {
"Id": "assetId",
"Name": "name",
"AssetTypeId": "TypeId",
"Description": "description",
"Metadata": [
{
"Id": "metadataId",
"Name": "name",
"Description": "description",
"SdsTypeCode": "18",
"Value": "{streamId}"
}
],
"StreamReferences": [
{
"Id": "StreamRefId",
"Description": "description",
"StreamId": "{streamId}"
}
],
"Status": {
"StreamReferenceId": "StreamRefId",
"StreamPropertyId": "Value",
"ValueStatusMappings": [
{
"Value": "value",
"Status": 1,
"DisplayName": "Display Name Indicator"
}
]
}
}
}
],
"CreationTime": "0001-01-01T00:00:00",
"ModifiedTime": "0001-01-01T00:00:00",
"ErrorInfo": {
"ErrorCount": 0
}
}
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"
}
}
Create Rule
Returns or creates a RuleModel object with the specified identifier in the IRuleStore.
Request
POST /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules/{ruleId}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string ruleId
Rule identifier.
Request Body
The RuleModel object.
{
"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 |
|---|---|---|
| 201 | RuleModel | A link to the RuleModel object. |
| 302 | None | An equivalent rule with the same identifier and definition already exists. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 409 | ResponseBody | A non-equivalent rule with the specified identifier already exists. |
| 500 | ResponseBody | Internal server error. |
Example response body
201 Response
{
"Id": "ruleId",
"Name": "name",
"Description": "description",
"AutomationId": "00000000-0000-0000-0000-000000000000",
"State": "Started",
"Expressions": [
{
"Field": "Id",
"Specifications": [
{
"Type": "Group",
"Name": "streamId"
}
]
}
],
"Outputs": [
{
"Field": "Asset",
"Value": {
"Id": "assetId",
"Name": "name",
"AssetTypeId": "TypeId",
"Description": "description",
"Metadata": [
{
"Id": "metadataId",
"Name": "name",
"Description": "description",
"SdsTypeCode": "18",
"Value": "{streamId}"
}
],
"StreamReferences": [
{
"Id": "StreamRefId",
"Description": "description",
"StreamId": "{streamId}"
}
],
"Status": {
"StreamReferenceId": "StreamRefId",
"StreamPropertyId": "Value",
"ValueStatusMappings": [
{
"Value": "value",
"Status": 1,
"DisplayName": "Display Name Indicator"
}
]
}
}
}
],
"CreationTime": "0001-01-01T00:00:00",
"ModifiedTime": "0001-01-01T00:00:00",
"ErrorInfo": {
"ErrorCount": 0
}
}
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"
}
}
409 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"
}
}
Create Or Update Rule
Creates or updates the specified rule in the IRuleStore.
Request
PUT /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules/{ruleId}
?Skip={Skip}&Count={Count}&KeepOldMetadata={KeepOldMetadata}&KeepOldAssets={KeepOldAssets}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string ruleId
Rule identifier.
[optional] integer Skip
An Int32 to determine how many results to skip. Defaults to DefaultSkip[optional] integer Count
An Int32 to determine how many results to return. Defaults to DefaultCount[optional] boolean KeepOldMetadata
A Boolean to determine whether or not existing metadata created by the rule should be preserved if the rule were deleted. Only valid for metadata rule delete requests.
Defaults to false.[optional] boolean KeepOldAssets
A Boolean to determine whether or not existing assets created by the rule should be kept. Only valid for asset rule delete requests.
Defaults to false.
Request Body
The RuleModel object to create or update.
{
"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 |
|---|---|---|
| 200 | RuleModel | The updated RuleModel object or a link to the new RuleModel object. |
| 201 | RuleModel | The updated RuleModel object or a link to the new RuleModel object. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 500 | ResponseBody | Internal server error. |
Example response body
200 Response
{
"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
}
}
201 Response
{
"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
}
}
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"
}
}
Delete Rule
Deletes the specified rule from the IRuleStore.
Request
DELETE /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules/{ruleId}
?Skip={Skip}&Count={Count}&KeepOldMetadata={KeepOldMetadata}&KeepOldAssets={KeepOldAssets}
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string ruleId
Rule identifier.
[optional] integer Skip
An Int32 to determine how many results to skip. Defaults to DefaultSkip[optional] integer Count
An Int32 to determine how many results to return. Defaults to DefaultCount[optional] boolean KeepOldMetadata
A Boolean to determine whether or not existing metadata created by the rule should be preserved if the rule were deleted. Only valid for metadata rule delete requests.
Defaults to false.[optional] boolean KeepOldAssets
A Boolean to determine whether or not existing assets created by the rule should be kept. Only valid for asset rule delete requests.
Defaults to false.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 204 | None | No content. |
| 403 | ResponseBody | Forbidden. |
| 404 | ResponseBody | The specified rule was not found. |
| 500 | ResponseBody | Internal server error. |
Execute Rule
Executes the specified rule.
Request
POST /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules/{ruleId}/execute
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string ruleId
Rule identifier.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 204 | None | No content. |
| 400 | ResponseBody | Missing or invalid inputs. |
| 403 | ResponseBody | Forbidden. |
| 404 | ResponseBody | The specified rule was not found. |
| 409 | ResponseBody | The automation identifier was invalid. |
| 500 | ResponseBody | Internal server error. |
Get Progress
Returns a description of the progress of the most recent execution of the rule and any errors.
Request
GET /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/assetrules/{ruleId}/progress
Parameters
string tenantId
Tenant identifier.string namespaceId
Namespace identifier.string ruleId
Rule identifier.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | ExecutionProgress | A ExecutionProgress object for the given rule id. |
| 403 | ResponseBody | Forbidden. |
| 404 | ResponseBody | The specified rule was not found. |
| 500 | ResponseBody | Internal server error. |
Example response body
200 Response
{
"State": "Running"
}
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"
}
}
Definitions
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 |
|---|---|
| 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
}
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"
}
}
ExecutionProgress
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| State | ProgressState | false | false | None |
{
"State": 0
}
ProgressState
Enumerated Values
| Property | Value | Description |
|---|---|---|
| Unknown | 0 | |
| Running | 1 | |
| Completed | 2 | |
| Stopped | 3 |