Apply Rules

  • Updated

URL: 
e.g. http://servername/InRuleRuleEngineService/HttpService.svc/ApplyRules

Method:
POST

See below for examples of requests and responses in both JSON and XML formats. The variations shown are:

  • File-based Rule Application (deployed on irServer)
  • Catalog Rule Application
    • Rule Application specified by either Name or GUID
    • Revision specified as Latest, Label, or Revision
    • Authentication using specified Username / Password, Single Sign-On, or using irServer config-specified credentials
  • Optional RequestId specified
  • Optional CacheTimeout specified
  • Optional ConnTimeout specified
  • Optional Overrides specified
  • Optional Output Options specified (overriding defaults) 

Sample JSON Requests

Sample JSON Request: Filesystem Rule Application

{
   "RuleApp": {
      "FileName": "Ruleapp1.ruleapp"
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Request: Catalog Rule Application: Latest Revision by Name

{
   "RuleApp":{
      "Password":"CatPassword",
      "RepositoryRuleAppRevisionSpec":{
         "RuleApplicationName":"Ruleapp1"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc",
      "UserName":"CatUsername"
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Request: Catalog Rule Application: Latest Revision by GUID

{
   "RuleApp":{
      "Password":"CatPassword",
      "RepositoryRuleAppRevisionSpec":{
         "Guid":"5f11d845-bda1-4f79-ba67-e8cd12d065f7"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc",
      "UserName":"CatUsername"
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}}

Sample JSON Request: Catalog Rule Application: Labeled Revision by Name

{
   "RuleApp":{
      "Password":"CatPassword",
      "RepositoryRuleAppRevisionSpec":{
           "Label":"Label1",
         "RuleApplicationName":"Ruleapp1"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc",
      "UserName":"CatUsername"
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Request: Catalog Rule Application: Specific Revision by Name

{
   "RuleApp":{
      "Password":"CatPassword",
      "RepositoryRuleAppRevisionSpec":{
           "Revision":3,
         "RuleApplicationName":"Ruleapp1"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc",
      "UserName":"CatUsername"
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Request: Catalog Rule Application: SSO Authentication (using service host account credential)

{
   "RuleApp":{
      "RepositoryRuleAppRevisionSpec":{
         "RuleApplicationName":"Ruleapp1"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc",
      "UseIntegratedSecurity":true
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Request: Catalog Rule Application: irServer config-specified credentials Authentication

{
   "RuleApp":{
      "RepositoryRuleAppRevisionSpec":{
         "RuleApplicationName":"Ruleapp1"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc"
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Request: Catalog Rule Application: RequestId, CacheTimeout, ConnTimeout, Overrides, Output Options specified

{
   "RequestId":"1627aea5-8e0a-4371-9022-9b504344e724",
   "RuleApp":{
      "CacheTimeout":"120",
      "ConnTimeout":"100",
      "Password":"CatPassword",
      "RepositoryRuleAppRevisionSpec":{
         "RuleApplicationName":"Ruleapp1"
      },
      "RepositoryServiceUri":"http:\/\/localhost\/InRuleCatalogService\/service.svc",
      "UseIntegratedSecurity":true,
      "UserName":"CatPassword"
   },
   "RuleEngineServiceOptions":{
      "Overrides":[
         // see Overrides for example.
      ],
      "RuleSessionOverrides":{
         "ExecutionTimeout":"PT40S",
         "MaxCycleCount":200000,
   "Now":"\/Date(928167600000-0500)\/",
      },
   },
   "RuleEngineServiceOutputTypes":{
      "ActiveNotifications":true,
      "ActiveValidations":true,
      "EntityState":true,
      "Overrides":true,
      "RuleExecutionLog":true
   },
   "EntityName":"Entity1",
   "EntityState":"{\"Field1\":\"1\"}"
}

Sample JSON Response

{
   "ActiveNotifications":[{
      "Changed":true,
      "ElementId":"String content",
      "FiredBy":["String content"],
      "IsActive":true,
      "ManagedByRuleEngine":true,
      "MarkedForRemoval":true,
      "Message":"String content",
      "NoteUniqueKey":"String content",
      "NotificationType":"String content"
   }],
   "ActiveValidations":[{
      "ElementIdentifier":"String content",
      "InvalidMessageText":"String content",
      "IsValid":true,
      "Reasons":[{
         "FiringRuleId":"String content",
         "ManagedByRuleEngine":true,
         "MarkedForRemoval":true,
         "MessageText":"String content",
         "OwningRuleId":"String content"
      }]
   }],
   "EntityState":"String content",
   "HasRuntimeErrors":false,
   "Overrides":[{
      "Name":"String content",
      "OverrideType":0,
      "Value":"String content"
   }],
   "RequestId":"1627aea5-8e0a-4371-9022-9b504344e724",
   "RuleExecutionLog":{
      "CalcsEvaluatedCount":9223372036854775807,
      "Messages":[{
         "Description":"String content",
         "ChangeType":0,
         "CollectionCount":2147483647,
         "CollectionId":"String content",
         "MemberId":"String content",
         "MemberIndex":2147483647
      }],
      "PerformedIncrementalEvaluation":true,
      "RulesEvaluatedCount":9223372036854775807,
      "RulesEvaluatedTrueCount":9223372036854775807,
      "TotalEvaluationCycles":9223372036854775807,
      "TotalExecutionTime":"P428DT10H30M12.3S",
      "TotalTraceFrames":2147483647
   },
   "RuleSessionState":"String content",
   "SessionId":"1627aea5-8e0a-4371-9022-9b504344e724"
}

Sample XML Requests

In all XML request examples below, elements must be ordered exactly as specified.

Sample XML Request: Filesystem Rule Application

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <FileName>Ruleapp1.ruleapp</FileName>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1
&gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;
</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: Latest Revision by Name

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <Password>CatPassword</Password>
    <RepositoryRuleAppRevisionSpec>
      <RuleApplicationName>RuleApp1</RuleApplicationName>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
    <UserName>CatUsername</UserName>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: Latest Revision by GUID

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <Password>CatPassword</Password>
    <RepositoryRuleAppRevisionSpec>
      <Guid>5f11d845-bda1-4f79-ba67-e8cd12d065f7</Guid>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
    <UserName>CatUsername</UserName>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: Labeled Revision by Name

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <Password>CatPassword</Password>
    <RepositoryRuleAppRevisionSpec>
      <Label>Label1</Label>
      <RuleApplicationName>RuleApp1</RuleApplicationName>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
    <UserName>CatUsername</UserName>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: Specific Revision by Name

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <Password>CatPassword</Password>
    <RepositoryRuleAppRevisionSpec>
       <Revision>3</Revision>
       <RuleApplicationName>RuleApp1</RuleApplicationName>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
    <UserName>CatUsername</UserName>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: SSO Authentication (using service host account credential)

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <RepositoryRuleAppRevisionSpec>
       <RuleApplicationName>RuleApp1</RuleApplicationName>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
    <UseIntegratedSecurity>true</UseIntegratedSecurity>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: irServer config-specified credentials Authentication

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RuleApp>
    <RepositoryRuleAppRevisionSpec>
       <RuleApplicationName>RuleApp1</RuleApplicationName>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
  </RuleApp>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Request: Catalog Rule Application: RequestId, CacheTimeout, ConnTimeout, Overrides, Output Options specified

<ApplyRulesRequest xmlns="http://www.inrule.com/XmlSchema/Schema">
  <RequestId>1627aea5-8e0a-4371-9022-9b504344e724</RequestId>
  <RuleApp>
    <CacheTimeout>100</CacheTimeout>
    <ConnTimeout>120</ConnTimeout>
    <Password>CatPassword</Password>
    <RepositoryRuleAppRevisionSpec>
       <RuleApplicationName>RuleApp1</RuleApplicationName>
    </RepositoryRuleAppRevisionSpec>
    <RepositoryServiceUri>http://localhost/InRuleCatalogService/service.svc</RepositoryServiceUri>
    <UserName>CatUsername</UserName>
  </RuleApp>
  <RuleEngineServiceOptions>
    <Overrides>
      <Override>
        <!-- see Overrides for examples -->
      </Override>
    </Overrides>
    <RuleSessionOverrides>
      <ExecutionTimeout>PT40S</ExecutionTimeout>
      <MaxCycleCount>200000</MaxCycleCount>
      <Now>1999-05-31T11:20:00</Now>
    </RuleSessionOverrides>
  </RuleEngineServiceOptions>
  <RuleEngineServiceOutputTypes>
    <ActiveNotifications>true</ActiveNotifications>
    <ActiveValidations>true</ActiveValidations>
    <EntityState>true</EntityState>
    <Overrides>true</Overrides>
    <RuleExecutionLog>true</RuleExecutionLog>
  </RuleEngineServiceOutputTypes>
  <EntityState>&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;Entity1 &gt;&lt;Field1&gt;1&lt;/Field1&gt;&lt;/Entity1&gt;</EntityState>
  <EntityName>Entity1</EntityName>
</ApplyRulesRequest>

Sample XML Response

<RuleEngineHttpServiceResponse xmlns="http://www.inrule.com/XmlSchema/Schema">
  <ActiveNotifications>
    <Notification>
      <Changed>true</Changed>
      <ElementId>String content</ElementId>
      <FiredBy>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String
content
</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String
content
</string>
      </FiredBy>
      <IsActive>true</IsActive>
      <ManagedByRuleEngine>true</ManagedByRuleEngine>
      <MarkedForRemoval>true</MarkedForRemoval>
      <Message>String content</Message>
      <NoteUniqueKey>String content</NoteUniqueKey>
      <NotificationType>String content</NotificationType>
    </Notification>
  </ActiveNotifications>
  <ActiveValidations>
    <Validation>
      <ElementIdentifier>String content</ElementIdentifier>
      <InvalidMessageText>String content</InvalidMessageText>
      <IsValid>true</IsValid>
      <Reasons>
        <ValidationReason>
          <FiringRuleId>String content</FiringRuleId>
          <ManagedByRuleEngine>true</ManagedByRuleEngine>
          <MarkedForRemoval>true</MarkedForRemoval>
          <MessageText>String content</MessageText>
          <OwningRuleId>String content</OwningRuleId>
        </ValidationReason>
      </Reasons>
    </Validation>
  </ActiveValidations>
  <EntityState>String content</EntityState>
  <HasRuntimeErrors>false</HasRuntimeErrors>
  <Overrides>
    <ConfiguredOverride>
      <Name>String content</Name>
      <OverrideType>DatabaseConnection</OverrideType>
      <Value>String content</Value>
    </ConfiguredOverride>
  </Overrides>
  <RequestId>1627aea5-8e0a-4371-9022-9b504344e724</RequestId>
  <RuleExecutionLog>
    <CalcsEvaluatedCount>9223372036854775807</CalcsEvaluatedCount>
    <Messages>
      <!--Valid elements of type: CollectionChangedMessage, ErrorMessage, NotificationChangeMessage, RuleSetActivationChangeMessage, RuleValueChangeMessage, TextFeedbackMessage, ValidationChangeMessage, ValueChangeMessage-->
     <RuleExecutionLogMessage i:type="CollectionChangedMessage" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <Description>String content</Description>
        <ChangeType>Added</ChangeType>
        <CollectionCount>2147483647</CollectionCount>
        <CollectionId>String content</CollectionId>
        <MemberId>String content</MemberId>
        <MemberIndex>2147483647</MemberIndex>
      </RuleExecutionLogMessage>
    </Messages>
    <PerformedIncrementalEvaluation>true</PerformedIncrementalEvaluation>
    <RulesEvaluatedCount>9223372036854775807</RulesEvaluatedCount>
    <RulesEvaluatedTrueCount>9223372036854775807</RulesEvaluatedTrueCount>
    <TotalEvaluationCycles>9223372036854775807</TotalEvaluationCycles>
    <TotalExecutionTime>P428DT10H30M12.3S</TotalExecutionTime>
    <TotalTraceFrames>2147483647</TotalTraceFrames>
  </RuleExecutionLog>
  <RuleSessionState>String content</RuleSessionState>
  <SessionId>1627aea5-8e0a-4371-9022-9b504344e724</SessionId>
</RuleEngineHttpServiceResponse>

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.