About this resource

Representation of a Rule

Properties

Property Description Type
createdOn Gets the creation datetime in UTC time. datetime
enabled Is rule enabled. boolean
expression Gets search expression based on conditions that are available for parsing. Applied and visible in response only in case 'trigger' has value 'daily'. string
id Gets the Id of this rule. guid
includeDraftRecords Indicates whether this rule can be executed on draft records. Applied and visible in response only in case 'target' has value 'record'. boolean
isInternal Internal rules can only be edited by operators. boolean
modifiedOn Gets the last modification datetime in UTC time. datetime
name Gets the name of this rule. string
tag Gets or sets the value of the Tag for this object. The value of this property has to be valid XML code. This property will not be returned by default. In order to include the property in the response, add a header with the name 'select-rule' and the value 'Tag' to your request. string
target Gets the object type that triggers this rule. string (values: settingdefinition, fielddefinition, indexertask, translation, settingcategory, usergroup, watermark, fieldgroup, collection, user, classification, record, language, filetype, organization, site, publication, subscription, filestore, savedview)
trigger Gets the trigger of this rule. string (values: whensavedordeleted, daily)
version Gets the version of this rule. int32

Relations

Method Name Select-key Resource type Description
GET self Provides a link to this resource.
GET conditions select-Rule: conditions RuleConditionCollection Collection of rule conditions
GET actions select-Rule: actions RuleActionCollection Collection of rule actions
GET modifiedby select-Rule: modifiedby User Gets or sets the user that last modified this resource.
GET createdby select-Rule: createdby User Gets or sets the user that created this resource.

Actions

Method Action Description Response codes
PUT /rule/{ruleId} edit Edits an existing rule
204 Request completed successfully
400 Bad request (in general)
403 Insufficient permissions
404 Rule not found
DELETE /rule/{ruleId} delete Deletes an existing rule.
204 Request completed successfully
403 Insufficient permissions
404 Rule not found

Examples

Editing a rule The following rule targets are supported:
  • Classification
  • Collection
  • Record / File
  • SavedView
The following rule triggers are supported:
  • WhenSavedOrDeleted
  • Daily
Bear in mind that:
  • Only properties can be updated.
  • Condition/action types cannot be updated.
  • You have to provide the index and condition type when updating properties of rule conditions/actions. If no index is provided, the update will be seen as a new rule condition/action and will be added at the end of the collection.
  • In order to remove a rule condition/action, you have to specify its index.

PUT /rule/31072990f5ec458a9145a7f9008c1404
{
"name": "updated name of a rule",
"enabled": "true",
          "includeDraftRecords": "false",
"target": "fieldgroup",
"trigger": "WhenSavedOrDeleted",
"conditions": {
  "addOrUpdate": [
  {
    "ConditionType": "ClassificationLinked",
    "index": 2,
    "directLinkOnly": false,
    "ClassificationId": "30b92c87-7b43-4a84-89eb-a81300fae78d"
  },
  {
    "ConditionType": "Reference",
    "reference": "<ref:httpRequest uri=\"https://YourFunction.azurewebsites.net/api/somefunc\" />"
  }
  ],
  "remove": [1]
},
"actions": {
  "addOrUpdate": [
  {
    "index": 0,
    "ActionType": "Reference",
    "reference": "<ref:httpRequest uri=\"https://YourFunction.azurewebsites.net/api/otherfunc\" />",
    "executionTime": "Delayed"
  },
  {
    "ActionType": "Reference",
    "reference": "<ref:httpRequest uri=\"https://YourFunction.azurewebsites.net/api/onemorefunc\" />"
  },
  {
    "ActionType": "ClassifyRecord",
    "gettingType": "Specified",
    "classificationId": "55b92c87-7b43-4a84-89eb-a81300fae7aa"
  },
  {
    "actionType": "ClassifyRecord",
    "gettingType": "CalculatedByReference",
    "identifierType": "NamePath",
    "reference": "<ref:text out=\"root\" />"
  },
  {
    "actionType": "ClassifyRecord",
    "gettingType": "CalculatedByReference",
    "identifierType": "Identifier",
    "reference": "<ref:text out=\"55b92c87-7b43-4a84-89eb-a81300fae7aa\" />"
  },
  {
    "ActionType": "UnclassifyRecord",
    "gettingType": "Specified",
    "classificationIds": [ 
                   "55b92c87-7b43-4a84-89eb-a81300fae7aa"
                   "66c03d98-8c54-5b95-90fc-b92411gbf8ba"
               ]
  },
  {
    "actionType": "UnclassifyRecord",
    "gettingType": "CalculatedByReference",
    "identifierType": "NamePath",
    "reference": "<ref:text out=\"root\" />"
  },
  {
    "actionType": "UnclassifyRecord",
    "gettingType": "CalculatedByReference",
    "identifierType": "Identifier",
    "reference": "<ref:text out=\"55b92c87-7b43-4a84-89eb-a81300fae7aa\" />"
  }
],
  "remove": [1, 3]
}
}
The code in the example does the following things:
  • It passes new values for the properties 'ClassificationId' and 'directLinkOnly' of the condition that has index 2.
  • It adds a new condition of the type Reference at the end.
  • It deletes the rule condition that has index 1.
  • It passes new values for the property 'Reference' of the rule action that has index 0.
  • It removes the rules actions that have the indexes 1 and 0.
Deleting a rule
DELETE /rule/9d88d5ece8c345e6a669a82000b10761