Rule REST API Design Notes

cancel
Showing results for 
Search instead for 
Did you mean: 

Rule REST API Design Notes

resplin
Intermediate
0 0 3,136

Obsolete Pages{{Obsolete}}

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




Payload Definitions


JSON will be used for payloads throughout the API.


RuleType


A rule type consists of a name and a display label.  It is used to as a way to indicate how a rule will be triggered.

{
    'name' : string,
    'displayLabel' : string,
    'url' : string
}

Notes:


  • url is the URL or the RuleType, eg /api/ruletypes/inbound.  This URL can not be used, but is there for completeness.

ActionDefinition


An action definition describes an action, including information about the actions parameters.

{
   'name' : string,
   'displayLabel' : string,
   'description' : string,
   'adHocPropertiesAllowed' : boolean,
   'parameterDefinitions' :
   [
      {
         'name' : string,
         'displayLabel' : string,
         'type' : string,
         'isMultiValued' : boolean,
         'isMandatory' : boolean
      },
      ...
   ],
   'applicableTypes' :
   [
      string,
      string,
      ...
   ]
}

Notes:


  • displayLabel for the action definition maps to the property title in the Java API.
  • if there are no parameter definitions then respond with an empty array
  • if there are no applicable types then respond with an empty array

ActionConditionDefinition


An action condition definition describes an action condition, including information about the action conditions parameters.

{
   'name' : string,
   'displayLabel' : string,
   'description' : string,
   'adHocPropertiesAllowed' : boolean,
   'parameterDefinitions' :
   [
      {
         'name' : string,
         'displayLabel' : string,
         'type' : string,
         'isMultiValued' : boolean,
         'isMandatory' : boolean
      },
      ...
   ]
}

Notes:


  • displayLabel for the action definition maps to the property title in the Java API.
  • if there are no parameter definitions then respond with an empty array

RuleSet


{
    'rules': Rule[],
    'inheritedRules': Rule[],
    'linkedToRuleSet' : String,
    'linkedFromRuleSets' : String[],
    'url' : String  
}

Notes:


  • rules is a array of the rules 'owned' by this rule set.  If the rule set is linked to another then this collection reflects the contents of the linked rule set.  This property is not present if no rules are owned.
  • inheritedRules is a URL to the rule set that this links to.  If this does not like to another rule set then this property is not present.  An example URL is '/api/node/workspace/SpacesStore/123-123-123/ruleset'.
  • linkedToRuleSet is a URL's to the rule set that this rule set links to.  If no rule set is being linked to then this value will not be present.
  • linkedFromRuleSets is an array of all the rule sets that link to this rule set.
  • url is a URL to this rule set.

See #Rule


Rule


Data relating to a Rule.

{     
    'id': String,
    'title': String,
    'description': String,
    'ruleType': String[],
    'applyToChildren': boolean,
    'executeAsynchronously': boolean,
    'disabled': boolean,
    'action' : Action,
    'owningNode':
    {
       'nodeRef' : String,
       'name' : String
    }
    'url': String
}

Note:


  • id is the guid of the rule.
  • ruleType is an array of the ruleType names e.g. ['inbound', 'update']
  • applyToChildren will be true if this rule applies to child folders of the folder that defines it, else false.
  • url contains the GETtable URL of the rule object.  This is read only.
  • action contains the related Action JSON object.
  • owningNode object contains the nodeRef of the node (usually a folder) that 'owns' this rule and the name of that node.  This is read only.

See #Action


Action


{
    'id': String,
    'actionDefinitionName': String,
    'description': String,
    'title': String,
    'parameterValues':
    {
       String : String,
       ...
    },
    'executeAsync': boolean,
    'runAsUser': String,
    'actions' : Action[],
    'conditions': Condition[],
    'compensatingAction' : Action,
    'url': String
}

Notes:


  • id is the action ID as defined by the action model.
  • parameterValues is a JSON object made up the of the name value pairs of parameter values.  The name of each slot in the object is the name of the parameter, the value is the value of the parameter.  If an action has no parameter values set then this property doesn't appear in the object
  • url contains the GETtable URL for this action e.g. '/alfresco/service/api/rules/workspace/SpacesStore/c2ab27bb-e298-4674-8a5c-b7db5f31a1f9/actions/68ee8028-70eb-4953-9633-9ccb21a3ff9f'
  • actions contains any contained actions in a JSON array.  If this is a composite action then this will be full of all the child actions.  If there are no child actions  then this property doesn't appear in the object.
  • conditions contains any action conditions for this action.  If this action doesn't have any conditions then this property doesn't appear in the object.
  • compensatingAction contains the compensation action for this action.  If there is no compensating action then this property doesn't appear in the object.

Condition


{
    'id': String,
    'description': String,
    'title': String,
    'conditionDefinitionName': String,
    'invertCondition': boolean,    
    'parameterValues':
    {
       String : String,
       ...
    },
    'url': String
}

ActionQueueItem


Provides information about the status of a queued action.

{
   'status' : String,
   'exception' :
   {
      'message' : String,
      'stackTrace' : String
   }
   'action' :
   {
      ...
   }
}

Notes:


  • Status takes one of three values.  Success if a synch action has been queued and executed successfully.  Fail if a synch action has been queued and failed during execution.  Queued if a asynch action has been queued.
  • Exception contains details of any error that may have occurred.  This is only provided if the action has failed to execute.
  • Action is an object containing the details of the action executed/queued.

Resources


Rule Type Collection


A collection of available rule types.


Get RuleType Collection


Gets all Rule Types defined by the system.

  GET /api/ruletypes