3.0 REST API for Rules and Actions

cancel
Showing results for 
Search instead for 
Did you mean: 

3.0 REST API for Rules and Actions

resplin
Intermediate
0 0 2,551

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Web Scripts
3.0
Draft. This is a work in progress


Data


Note: Mandatory fields are displayed in bold


Rule Details


Details of a rule which include:


  • 'owningNodeRef' (The node that this rule applies to. Provided when retrieving rule details.)
  • 'ruleNodeRef' (The node that represents this rule. Provided when retrieving the rule details.)
  • 'title' (The title of the rule)
  • 'description' (The description of the rule)
  • 'ruleTypes' (Array of rule types associated with this rule)
  • 'action' (action details for the action resource directly associated with this rule. Include when sending rule details. This property is provided when retrieving rule details. In this case only partial details for the action may be provided, however these details will always include the URL to this action resource)
  • 'executeAsync' (Indicates whether the rule should execute the action asynchronously or not)
  • 'ruleDisabled' (Indicates whether or not this rule is marked as disabled or not)
  • 'appliedToChildren' (Indicates whether the rule is applied to all the children of the associated actionable node (rather than just the node itself).
  • 'url' (URL to this RuleDetails resource. Provided when retrieving rule details).

RuleType Details


Details of a rule type which include:


  • 'name' (The name of the rule type) 
  • 'displayLabel' (The display label of the rule type)
  • 'url' (URL to this RuleTypeDetails resource)

Action Details


Details of an action which include:


  • 'id' (Unique identifier for this action. Provided when retrieving the action details. Send in the action details when wanting to update an existing rule/action through using PUT).
  • 'actionDefinitionName' (The name of the action definition that relates to this action)
  • 'title' (The title of the action)
  • 'description' (The description of the action)
  • 'executeAsync' (Indicates whether to run the action asynchronously or not)
  • 'parameterValues' (Associative array (map) of parameter values, If this action does not have any parameter values, then this property is either 'null' or not present.)

TODO At the moment a URL to a action or condition resource is associated with a ruleNodeId and owning node, so some more thought is needed for the URL arrays below to make the URLs dependant on only an actionID or conditionID respectively.


  • 'conditions' (Array of Condition Details for the condition resources associated with this action. Include when sending action details if this action has conditions associated with it. If this action does not have any conditions associated with it, then this property must either be 'null' or not be included. This property is provided as an associative array (map keyed by ID) when retrieving action details, if there are conditions associated with this action. In this case, for each condition in the array, only partial details may be provided, however these details will always include the URL to the respective condition's resource.)
  • 'actions' (Array of Action Details for the action resources associated with this action. Include when sending action details if this action is a composite action. If this action is not a composite action, then this property must either be 'null' or not be included. This property is provided as an associative array (map keyed by ID) when retrieving action details, if this action is a composite action. In this case, for each 'nested' action in the array, only partial details may be provided, however these details will always include the URL to the respective action's resource.)
  • compensatingAction (Action Details for the compensating action. Include if there is a compensating action for this action. If there is no compensating action, then this property must either be 'null' or not be included)
  • 'url' (URL to this ActionDetails resource. Provided when retrieving action details)

Condition Details


Details of a condition which include:


  • 'id' (Unique identifier for this condition object. Provided when retrieving the condition details. Send in the condition details when wanting to update an existing rule/action/condition through using PUT)
  • 'parameterValues' (An associative array (map) of parameter values for the condition)
  • 'conditionDefinitionName' (The definition name for this condition. Mandatory when sending details to create a new condition)
  • 'invertCondition' (Indicates whether the condition result should be inverted. If a value is not sent in the condition details for this property, then the value thereof defaults to 'false')
  • 'url' (URL to this ConditionDetails resource. Provided when retrieving condition details.)

ActionDefinition Details


Details of an action definition which include:


  • 'applicableTypes' (types, QNames from content model, that this action definition is applicable for)
  • 'name' (The name of this action definition)
  • 'title' (The title of this action definition)
  • 'description' (The description of this action definition)
  • 'adhocPropertiesAllowed' (Indicates whether this action definition allows adhoc properties to be set or not)
  • 'parameterDefinitions' (Array of parameter definitions for this action definition)
  • 'url' (URL to this ActionDefinitionDetails resource)

ConditionDefinition Details


Details of an condition definition which include:


  • 'name' (The name of this action definition)
  • 'title' (The title of this action definition)
  • 'description' (The description of this action definition)
  • 'adhocPropertiesAllowed' (Indicates whether this action definition allows adhoc properties to be set or not)
  • 'parameterDefinitions' (Array of parameter definitions for this action definition)
  • 'url' (URL to this ConditionDefinitionDetails resource)

ParameterDefinition Details


Details of a parameter definition which include:


  • 'name' (The name of the parameter. This is unique and is used to identify the parameter)
  • 'displayLabel' (The display label of the parameter)
  • 'type' (The QName of the parameter from the content model)
  • 'multiValued' (Indicates if the parameter has multiple values or not)
  • 'mandatory' (Indicates if the parameter is mandatory or not)
  • 'url' (URL to this ParameterDefinitionDetails resource)

ActionQueueItem Details


Details of an item on the action queue resource which include:


  • 'action' (details of the action to execute)
  • 'nodeRef' (actionedUpon node reference to execute the action against)
  • checkConditions (indicates whether to check the conditions on the action before it is executed. If set to 'true', then if one of the conditions on the action fails, then the action will not be executed. Otherwise, if set to 'false' then the conditions on the action will be ignored and the action will be executed regardless. If this field is not sent then a default value of 'true' is used)
  • 'executeAsync' (indicates whether or not to execute the action asynchronously. If this field is not sent then a default value of 'false' is used )

ActionQueueItemStatus Details


Details of the status of an action queue item which include:


  • 'actionQueueItemId' (ID allocated to the action queue item when it is added to the action queue resource)
  • 'status' (execution status for the respective action queue item [PENDING | COMPLETE])
  • 'actionId' (ID of the action which is part of the action queue item (associated with this status)
  • 'actionQueueItemStatusUrl' (if the action has been 'flagged' to execute asynchronously, then this property will be present to provide a way to obtain the status at a later stage)

Resources


RuleType Collection


Methods:


GET /api/rules/types
     

Rule Collection


The rule collection may be filtered by providing values for the following optional parameters:


  • 'includeInherited' : indicates whether or not to include rules inherited from the actionable node's parents (if not provided, the value thereof defaults to 'true').
  • 'ruleTypeName' : if provided, filters the rule collection to include only those rules that are of the given rule type.

TODO - 'has rules on node' - this can possibly be implemented by GET, by adding a 'getMetadata' URL parameter to the URL templates below. In this case, if the 'getMetadata' parameter is provided, then metadata about the rule collection would be returned (instead of the actual collection) containing a property how many ruledetails items are in the collection.

Methods:


GET /api/node/{storeType}/{storeId}/{nodeId}/rules?includeInherited={includeInherited?}&ruleTypeName={ruleTypeName?}
     

GET /api/path/{storeType}/{storeId}/{nodeId}/rules?includeInherited={includeInherited?}&ruleTypeName={ruleTypeName?}
     

GET /api/rules/appliedtonode/{storeType}/{storeId}/{nodeId}?includeInherited={includeInherited?}&ruleTypeName={ruleTypeName?}
     

POST /api/node/{storeType}/{storeId}/{nodeId}/rules
      => RuleDetails
     

POST /api/path/{storeType}/{storeId}/{nodeId}/rules
      => RuleDetails
     

POST /api/rules/appliedtonode/{storeType}/{storeId}/{nodeId}
      => RuleDetails
     

TODO - decide the best way forward (for PUT below) to easily address enabling or disabling all rules for a given actionable node. This will most likely focus on the node as the base resource - this needs further discussion

NOTE: - PUT and DELETE here are less important to implement than their counterparts for a single Rule resource


PUT /api/node/{storeType}/{storeId}/{nodeId}/rules
      => RuleDetails[]
     

PUT /api/path/{storeType}/{storeId}/{nodeId}/rules
      => RuleDetails[]
     

PUT /api/rules/appliedtonode/{storeType}/{storeId}/{nodeId}
      => RuleDetails[]
     

DELETE /api/node/{storeType}/{storeId}/{nodeId}/rules

DELETE /api/path/{storeType}/{storeId}/{nodeId}/rules

DELETE /api/rules/appliedtonode/{storeType}/{storeId}/{nodeId}

Rule


Methods:


GET /api/rules/{store_type}/{store_id}/{rule_id}
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}
     

The PUT operation is used to update a rule. To disable or enable an individual rule, send the Rule Details including just the 'ruleNodeRef' and the 'ruleDisabled' field set to the appropriate value of either 'true' or 'false'.


PUT /api/rules/{store_type}/{store_id}/{rule_id}
      => RuleDetails
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}
      => RuleDetails
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}
      => RuleDetails
     

DELETE /api/rules/{store_type}/{store_id}/{rule_id}

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}

Condition Collection


A condition collection resource is a list of conditions associated with an action.

Methods:


POST /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions
      => ConditionDetails
     

POST /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions
      => ConditionDetails
     

POST /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions
      => ConditionDetails
     

POST /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions
      => ConditionDetails
     

POST /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions
      => ConditionDetails
     

POST /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions
      => ConditionDetails
     




GET /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions
     

GET /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions
     




PUT /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions
      => ConditionDetails[]
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions
      => ConditionDetails[]
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions

      => ConditionDetails[]
     

PUT /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions
      => ConditionDetails[]
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions
      => ConditionDetails[]
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions
      => ConditionDetails[]
     




DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions

DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions

Condition


A condition resource is one of the conditions (identified by 'conditionId') in the condition collection associated with an action

Methods:


GET /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions/{conditionId}
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions/{conditionId}
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions/{conditionId}
     

GET /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions/{conditionId}
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions/{conditionId}
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions/{conditionId}
     




PUT /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions/{conditionId}
      => ConditionDetails
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions/{conditionId}
      => ConditionDetails
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions/{conditionId}
      => ConditionDetails
     

PUT /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions/{conditionId}
      => ConditionDetails
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions/{conditionId}
      => ConditionDetails
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions/{conditionId}
      => ConditionDetails
     




DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/conditions/{conditionId}

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions/{conditionId}

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/conditions/{conditionId}

DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/conditions/{conditionId}

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions/{conditionId}

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/conditions/{conditionId}

Action Collection


The action collection resource consists of a given composite action's child actions, where that composite action is in turn associated with a rule (either directly or indirectly through other ancestor composite actions).

Methods:


POST /api/rules/{store_type}/{store_id}/{rule_id}/action/actions
      => ActionDetails
     

POST /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions
      => ActionDetails
     

POST /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions
      => ActionDetails
     

POST /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/actions
      => ActionDetails
     

POST /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/actions
      => ActionDetails
     

POST /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/actions
      => ActionDetails
     




GET /api/rules/{store_type}/{store_id}/{rule_id}/action/actions
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions
     

GET /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/actions
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/actions
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/actions
     




DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/actions

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions

DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}/actions

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/actions

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}/actions

Action


An action resource is an action which has previously been applied to a rule, with that action either being the 'root action' directly associated with that rule, or it being a child action of a parent composite action associated with that rule.

Methods:


GET /api/rules/{store_type}/{store_id}/{rule_id}/action 
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action 
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action
     

GET /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}
     

GET /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}
     

GET /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}
     




PUT /api/rules/{store_type}/{store_id}/{rule_id}/action 
      => ActionDetails
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action
      => ActionDetails
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action
      => ActionDetails
     

PUT /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}
      => ActionDetails
     

PUT /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}
      => ActionDetails
     

PUT /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}
      => ActionDetails
     




DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action

DELETE /api/rules/{store_type}/{store_id}/{rule_id}/action/actions/{action_id}

DELETE /api/node/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}

DELETE /api/path/{store_type}/{store_id}/{id}/rules/{rule_id}/action/actions/{action_id}

ConditionDefinition Collection


Methods:


GET /api/rules/conditiondefs
     

ConditionDefinition


Methods:


GET /api/rules/conditiondefs/{conditionDefinitionName}
     

ActionDefinition Collection


Methods:


GET /api/rules/actiondefs
     

GET /api/node/{store_type}/{store_id}/{id}/actiondefs
     

GET /api/path/{store_type}/{store_id}/{id}/actiondefs
     

ActionDefinition


Methods:


GET /api/rules/actiondefs/{actionDefinitionName}
     

GET /api/rules/actiondefs/node/{store_type}/{store_id}/{id}/{actionDefinitionName}
     

GET /api/rules/actiondefs/path/{store_type}/{store_id}/{id}/{actionDefinitionName}
     

ParameterDefinition Collection


GET /api/rules/conditiondefs/{conditionDefinitionName}/parameterdefs
     

GET /api/rules/actiondefs/{actionDefinitionName}/parameterdefs
     

GET /api/rules/parameterdefs
     

ParameterDefinition


GET /api/rules/parameterdefs/{parameterDefinitionName}
     

GET /api/rules/conditiondefs/{conditionDefinitionName}/parameterDefs/{parameterDefinitionName}
     

GET /api/rules/actiondefs/{actionDefinitionName}/parameterDefs/{parameterDefinitionName}
     

ActionQueue


TODO Some more thought is needed for implementing the async execution of actions on the queue and returning a URL in the ActionQueueItemStatusDetails to provide a way to fetch the status of an action at some later stage which has been 'flagged' for async execution.
Also make sure synchronous execution of actions is fully catered for.

Methods:


POST /api/actionqueue
      => ActionQueueItemDetails
     

ActionQueueItemStatus


Methods:


GET /api/actionqueue/items/{actionQueueItemId}/status
     

Futures


Data


ConditionStatus Details


This can be the evaluation status for a single condition, or for many conditions evaluated as a single unit.


  • 'passed' (Indicates whether the condition, or unit of many conditions, pass or not)

Resources


Action Collection


Methods:


POST /api/actions/{storeType}/{storeId}/{nodeId}
      => ActionDetails
     

GET /api/actions/{storeType}/{storeId}/{nodeId}
     

DELETE /api/actions/{storeType}/{storeId}/{nodeId}

Action


Methods:


GET /api/actions/{actionId}/{storeType}/{storeId}/{actionbleNodeId}
     

PUT /api/actions/{storeType}/{storeId}/{actionbleNodeId}
      => ActionDetails
     

DELETE /api/actions/{actionId}/{storeType}/{storeId}/{actionbleNodeId}

ConditionStatus


Methods:


GET /api/rules/conditionstatus?node={storeType}_{storeId}_{nodeId}
     

GET /api/rules/conditionstatus/{conditionId}?node={storeType}_{storeId}_{nodeId}