Rule REST API Design Notes

From AlfrescoWiki

Jump to: navigation, search

Contents

[edit] Payload Definitions

JSON will be used for payloads throughout the API.

[edit] 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.

[edit] 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

[edit] 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

[edit] 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

[edit] 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

[edit] 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.

[edit] Condition

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

[edit] 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.

[edit] Resources

[edit] Rule Type Collection

A collection of available rule types.

[edit] Get RuleType Collection

Gets all Rule Types defined by the system.

  GET /api/ruletypes
     <= RuleType[]

Example response data:

{
   "data":
   [
      {
         "name" : "inbound", 
         "displayLabel" : "Inbound",
         "url" : "/api/ruletypes/inbound"
      },
      {
         "name" : "outbound", 
         "displayLabel" : "Outbound",
         "url" : "/api/ruletypes/outbound"
      }
   ]
}

See #RuleType

[edit] Action Definition Collection

Collection of the available actions.

[edit] Get Action Definition Collection

GET /api/actiondefinitions
   <= ActionDefinition[]

Example response data:

{
   "data" : 
   [
      {
         "name" : "email",
         "displayLabel" : "E-Mail Action",
         "description" : "This action sends an email to a user",
         "adHocPropertiesAllowed" : false,
         "parameterDefinitions" :
         [
            {
               "name" : "to",
               "displayLabel" : "To",
               "type" : "d:text",
               "isMultiValued" : false,
               "isMandatory" : true
            },
            {
               "name" : "subject",
               "displayLabel" : "Subject",
               "type" : "d:text",
               "isMultiValued" : false,
               "isMandatory" : true
            },
            ...
         ],
         "applicableTypes" : []
      }
   ]
}

See #ActionDefinition

[edit] Action Condition Definition Collection

Collection of action conditions available.

[edit] Get Action Condition Definition Collection

GET /api/actionconditiondefinitions 
   <= ActionConditionDefinition[]

Example response data:

{
   "data" : 
   [
      {
         "name" : "has-aspect",
         "displayLabel" : "Has Aspect",
         "description" : "Indicates whether a node has a particular aspect or not",
         "adHocPropertiesAllowed" : false,
         "parameterDefinitions" :
         [
            {
               "name" : "aspect",
               "displayLabel" : "Aspect",
               "type" : "d:qname",
               "isMultiValued" : false,
               "isMandatory" : true
            }
         ]
      }
   ]
}

See #ActionConditionDefinition

[edit] Rule Set

[edit] Get Rule Set

Gets the rule set for a node.

GET /api/node/{store_type}/{store_id}/{id}/ruleset
    <= RuleSet
    ?ruleType={rule_type?}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_type - the rule type to filter the returned rule set by. For example, if ruleType is set to "outbound" then only outbound rules will appear in both the rules and inherited rules collections within the ruleset.

Example responses:

This is a rule set that is linked to another rule set. It has one inherited rule and one rule from the linked rule set.

Note that only reference information is returned for a each rule. For the full information about a rule (ie: details or the actions and conditions) use the GET method on the rule resource.

In this example the node workspace/SpacesStore/000-000-000 rules are linked to the node workspace/SpacesStore/000-000-001 and one rule is inherited from workspace/SpacesStore/000-000-002 which is in the parent hierarchy of workspace/SpacesStore/000-000-000.

{
   data : 
   {
       "rules":
       [
          {
             "id": "123-123-R01,
             "title": "Copy Nodes",
             "description": "This rule copies nodes into my folder.",
             "ruleType" : ["inbound"],
             "disabled": false,
             "owningNode" :
             {
                "nodeRef" : "workspace://SpacesStore/000-000-001",
                "name" : "My Folder"
             }
             "url": "/api/node/workspace/SpacesStore/000-000-001/ruleset/rules/123-123R01"
          } 
       ],
       "inheritedRules":
       [
          {
             "id": "123-123-R02,
             "title": "Apply versionable aspect",
             "description": "This rule applies the versionable aspect.",
             "ruleType" : ["inbound"],
             "disabled": false,
             "owningNode" :
             {
                "nodeRef" : "workspace://SpacesStore/000-000-002",
                "name" : "Folder Two"
             }
             "url": "/api/node/workspace/SpacesStore/000-000-002/ruleset/rules/123-123R02"
          } 
       ],
       "linkedToRuleSet" : "/api/node/workspace/SpacesStore/000-000-000/ruleset",
       "url" : "/api/node/workspace/SpacesStore/000-000-001/ruleset"   
   }
}

This is a rule set that is linked to by 2 other rules set. It has one rule and none inherited.

{
   data : 
   {
       "rules":
       [
          {
             "id": "123-123-R01,
             "title": "Copy Nodes",
             "description": "This rule copies nodes into my folder.",
             "ruleType" : ["inbound"],
             "disabled": false,
             "owningNode" :
             {
                "nodeRef" : "workspace://SpacesStore/000-000-L01",
                "name" : "Folder Three"
             }
             "url": "/api/node/workspace/SpacesStore/000-000-L01/ruleset/rules/123-123R01"
          } 
       ],
       "linkedFromRuleSets" : 
       [
          "/api/node/workspace/SpacesStore/000-000-L02/ruleset",           
          "/api/node/workspace/SpacesStore/000-000-L03/ruleset"
       ]
       "url" : "/api/node/workspace/SpacesStore/000-000-L01/ruleset"   
   }
}

See #RuleSet

[edit] Inherited Rules Collection

A collection of rules inherited by the rule set.

[edit] Get Inherited Rules Collection

Gets a list of all the inherited rules for a given node.

GET /api/node/{store_type}/{store_id}/{id}/ruleset/inheritedrules
    <= Rules[]
    ?ruleType={rule_type?}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_type - Rule type filter. If set to a valid ruleType value, then only rules having the type specified will be returned.

Example response data:

Note that only reference information is returned for a each rule. For the full information about a rule (ie: details or the actions and conditions) use the GET method on the rule resource.

{
   data : 
   [
      {
         "id" : "123-123-R01,
         "title" : "Copy Nodes",
         "description" : "This rule copies nodes into my folder.",
         "ruleType" : ["inbound"], 
         "disabled" : false,
         "owningNode" :
         {
            "nodeRef" : "workspace://SpacesStore/000-000-001",
            "name" : "Folder One"
         }
         "url": "/api/node/workspace/SpacesStore/000-000-001/ruleset/rules/123-123R01"
      },
      {
         "id" : "123-123-R02,
         "title" : "Archive node",
         "description" : "Archives this node when its removed.",
         "ruleType" : ["outbound"], 
         "disabled" : false,
         "owningNode" :
         {
            "nodeRef" : "workspace://SpacesStore/000-000-002",
            "name" : "Folder Two"
         }
         "url": "/api/node/workspace/SpacesStore/000-000-002/ruleset/rules/123-123R02"
      },
   ]
}

Note:

  • The url attribute points to the actual location of the rule. The first part of the URL being the node reference to the owning folder.

See #Rule

[edit] Rules Collection

A collection of rules owned by the rule set.

[edit] Get Rules Collection

Gets a list of all the rules for a given node. The node can be specified either using a node reference or a query path.

GET /api/node/{store_type}/{store_id}/{id}/ruleset/rules
    <= Rules[]
    ?ruleType={rule_type?}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_type - Rule type filter. If set to a valid ruleType value, then only rules having the type specified will be returned.

Example response data:

Note that only reference information is returned for a each rule. For the full information about a rule (ie: details or the actions and conditions) use the GET method on the rule resource.

{
   data : 
   [
      {
         "id" : "123-123-R01,
         "title" : "Copy Nodes",
         "description" : "This rule copies nodes into my folder.",
         "ruleType" : ["inbound"], 
         "disabled" : false,
         "owningNode" :
         {
            "nodeRef" : "workspace://SpacesStore/000-000-000",
            "name" : "Folder One"
         }
         "url": "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/123-123R01"
      },
      {
         "id" : "123-123-R02,
         "title" : "Archive node",
         "description" : "Archives this node when its removed.",
         "ruleType" : ["outbound"], 
         "disabled" : false,
         "owningNode" :
         {
            "nodeRef" : "workspace://SpacesStore/000-000-000",
            "name" : "Folder One"
         }
         "url": "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/123-123R02"
      },
   ]
}

See #Rule

[edit] Post Rule Collection

Creates a new rule.

POST /api/node/{store_type}/{store_id}/{id}/ruleset/rules
     => Rule
     <= Rule

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id

Example request data:

Note that this is an example of the structure of the request. The details of the actions and conditions may not be correct.

This example shows a rule that does a copy when a particular aspect is present. If the rule fails a compensating action that executes a web script is run.

{

    "title": "Copy My Stuff",
    "description": "This rule copies new content with myAspect into my folder",
    "ruleType": ["inbound"],
    "applyToChildren": false,
    "executeAsynchronously": true,
    "disabled": false,
    "action" :
    {
       "actionDefinitionName": "composite-action",
       "actions" :
       [
          {
             "actionDefinitionName": "copy",
             "parameterValues":
             {
                "destinationFolder" : "workspace://SpacesStore/123-123-123",
                "deepCopy" : false
             }
          }
       ],
       "conditions" :
       [
          {
             "actionDefinitionName": "has-aspect",
             "parameterValues":
             {
                "aspect" : "cm:myAspect"
             }
          }
       ],
       "compensatingAction" :
       {
          "actionDefinitionName": "executeScript",
          "parameterValues":
          {
             "scriptLocation" : "workspace://SpacesStore/123-123-S01"
          }
       }
    }
}

Example response data:

{
   data : 
   {
      "id" : "123-123-R11,
      "title": "Copy My Stuff",
      "description": "This rule copies new content with myAspect into my folder",
      "ruleType": ["inbound"],
      "disabled": false,
      "url": "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/123-123R11"
   }
}

See #Rule

[edit] Rule

A rule.

[edit] Get Rule

Get the details of a rule. The details returned are fully expanded, including child actions (if composite action), conditions and compensating actions.

GET /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}
    <= Rule

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_id- the id of the rule to get

Example response data:

{     
    "id" : "RLE-001",
    "title": "Copy My Stuff",
    "description": "This rule copies new content with myAspect into my folder",
    "ruleType": ["inbound"],
    "applyToChildren": false,
    "executeAsynchronously": true,
    "disabled": false,
    "action" :
    {
       "id" : "ACT-001",
       "actionDefinitionName": "composite-action",
       "actions" :
       [
          {
             "id" : "ACT-002",
             "actionDefinitionName": "copy",
             "parameterValues":
             {
                "destinationFolder" : "workspace://SpacesStore/123-123-123",
                "deepCopy" : false
             },
             "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action/actions/ACT-002"
          }
       ],
       "conditions":
       [
          {
             "id" : "CND-001",
             "actionDefinitionName": "has-aspect",
             "parameterValues":
             {
                "aspect" : "cm:myAspect"
             },
             "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action/conditions/CND-001"
          }
       ],
       "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action"
    },
    "owningNode" :
    {
       "nodeRef" : "workspace://SpacesStore/000-000-000",
       "name" : "Folder One"
    }
    "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001"
}

[edit] Put Rule

Update the details of a rule. All the details of the rule are updated, actions (if composite), conditions and compensating actions are added. The lists provided in this update (eg conditions) are taken to be the total current state of the rule so the whatever values are currently in the list they are replaced by what is sent. If, for example, a rule has two conditions and the sent rule update has an empty condition list, the updated rule will have no conditions. If, however, the "conditions" value was not present in the sent JSON at all, then no changes would be made to the Rule and it would continue to have two conditions. In summary, send empty array to clear list, exclude value from JSON for no changes.

Sending the ID of an object that already exists (for example a child action) is highly recommended as it ensure that that existing object is updated. If no ID is provided the web script will presume it is a new object and create an ID accordingly. A read only property such as url need not be sent in the update, but will do no harm if it is.

NOTE for finer control over the update of a rule in future API enhancements a "meta data only" parameter may be added to this web script and the finer grain web scripts that act on the collections of the rule may be used.

PUT /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}
    => Rule
    <= Rule

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_id- the id of the rule to update

Example request data:

In this example I am adding a condition to an existing rule.

{     
    "id" : "RLE-001",
    "title": "Copy My Stuff",
    "description": "This rule copies new content with myAspect into my folder",
    "ruleType": ["inbound"],
    "applyToChildren": false,
    "executeAsynchronously": true,
    "disabled": false,
    "action" :
    {
       "id" : "ACT-001",
       "actionDefinitionName": "composite-action",
       "actions" :
       [
          {
             "id" : "ACT-002",
             "actionDefinitionName": "copy",
             "parameterValues":
             {
                "destinationFolder" : "workspace://SpacesStore/123-123-123",
                "deepCopy" : false
             },
             "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action/actions/ACT-002"
          }
       ],
       "conditions":
       [
          {
             "actionDefinitionName": "has-aspect",
             "parameterValues":
             {
                "aspect" : "cm:myAspect"
             }              
          }
       ],
       "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action"
    },
    "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001"
}

Example response data:

 {     
    "id" : "RLE-001",
    "title": "Copy My Stuff",
    "description": "This rule copies new content with myAspect into my folder",
    "ruleType": ["inbound"],
    "applyToChildren": false,
    "executeAsynchronously": true,
    "disabled": false,
    "action" :
    {
       "id" : "ACT-001",
       "actionDefinitionName": "composite-action",
       "actions" :
       [
          {
             "id" : "ACT-002",
             "actionDefinitionName": "copy",
             "parameterValues":
             {
                "destinationFolder" : "workspace://SpacesStore/123-123-123",
                "deepCopy" : false
             },
             "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action/actions/ACT-002"
          }
       ],
       "conditions":
       [
          {
             "id" : "CND-001",
             "actionDefinitionName": "has-aspect",
             "parameterValues":
             {
                "aspect" : "cm:myAspect"
             },
             "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action/conditions/CND-001"
          }
       ],
       "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001/action"
    },
    "url" : "/api/node/workspace/SpacesStore/000-000-000/ruleset/rules/RLE-001"
}


[edit] Delete Rule

Deletes a rule.

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

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_id - the id of the rule to delete

[edit] Action Collection (work in progress)

List of actions.

[edit] Get Action Collection

Get all the actions of a composite action.

GET /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}/action/actions
    <= Action[]

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_id- the rule id

Example response:

{
}

[edit] Post Action Collection

Add a new action to an existing composite action.

POST /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}/action/actions
     => Action
     <= Action

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id - the rule id

Example request:

{
}

Example response:

{
}

[edit] Action

Action resource. Represents an action instance.

[edit] Get Rule Action

Gets the action instance associated with a rule.

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

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_id- the rule id
  • action_id - the action id

Example response:

{
}

[edit] Get Action

Get an action instance from the list of actions on a rules composite action.

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

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the node id
  • rule_id- the rule id
  • action_id - the action id

Example response:

{
}

[edit] Put Action

Adds a new action to a rules composite action.

PUT /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}/action/actions/{actionid}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id

Example request:

{
}

Example response:

{ 
}

[edit] Delete Action

Removes an action from a rules composite action.

DELETE /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{ruleId}/action/actions/{actionid}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id

[edit] Condition Collection

List of conditions that hang under an action.

[edit] Get Action Condition Collection

Gets the list of action conditions for an action.

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

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id

Example response:

{
}

[edit] Post Action Condition Collection

Add a condition to an actions collection of conditions.

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

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id

Example request:

{
}

Example response:

{
}

[edit] Condition

Condition instance.

[edit] Get Condition

Gets the condition found on an action.

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

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id
  • condition_id - the condition id

Example request:

{
}

Example response:

{
}

[edit] Put Condition

Adds a new condition to those found on an action.

PUT /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}/action/conditions/{condition_id}
PUT /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}/action/actions/{action_id}/conditions/{condition_id}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id
  • condition_id - the condition id

Example request:

{
}

Example response:

{
}

[edit] Delete Condition

Deletes a condition found on an action.

DELETE /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{ruleId}/action/conditions/{conditionid}
DELETE /api/node/{store_type}/{store_id}/{id}/ruleset/rules/{ruleId}/action/actions/{actionid}/conditions/{conditionid}

Parameters:

  • store_type - the store type
  • store_id - the store id
  • id - the id of the node or a search that retrieves exactly one node.
  • rule_id- the rule id
  • action_id - the action id
  • condition_id - the condition id

Example request:

{
}

Example response:

{
}

[edit] Action Execution Queue

Provides an execution queue for actions. Actions can be executed synchronously or asynchronously.

[edit] Post Action Queue

Adds a new action to the execution queue. If the async parameter is set to true the action is placed on the the async action execution queue and the reponse is returned to the user. The action will then be executed by the repository at some point in the future. If the async parameter is set to false, then the action is executed before the response is returned to the user. The response can then have details of the success or failure of the action execution.

POST /api/actionQueue      
     => Action
     <= ActionQueueItem
     &async={async?}

Parameters:

  • async - if true action is executed asynchronously, otherwise synchronously

Example request:

In this example we want to execute a copy action:

{
   "actionedUponNode" : "workspace://SpacesStore/123-123-abc",
   "actionDefinitionName": "copy",
   "parameterValues":
   {
      "destinationFolder" : "workspace://SpacesStore/123-123-123",
      "deepCopy" : false
   }
}

Example response:

In this example the action was executed synchronously and completed successfully:

{
   "data" : 
   {
      "status" : "success",
      "actionedUponNode" : "workspace://SpacesStore/123-123-abc",
      "action" : 
      {
         "actionDefinitionName": "copy",
         "parameterValues":
         {
            "destinationFolder" : "workspace://SpacesStore/123-123-123",
            "deepCopy" : false
         }
      }
}

In this example the action was executed synchronously and encountered an error:

{
   "data" : 
   {
      "status" : "fail",
      "actionedUponNode" : "workspace://SpacesStore/123-123-abc",
      "exception" :
      {
         "message" : "Unable to copy node",          
         "stackTrace" : "......."
      },
      "action" : 
      {
         "actionDefinitionName": "copy",
         "parameterValues":
         {
            "destinationFolder" : "workspace://SpacesStore/123-123-123",
            "deepCopy" : false
         }
      }
}

In this example the action was executed asynchronously:

{
   "data" : 
   {
      "status" : "queued",
      "actionedUponNode" : "workspace://SpacesStore/123-123-abc",
      "action" : 
      {
         "actionDefinitionName": "copy",
         "parameterValues":
         {
            "destinationFolder" : "workspace://SpacesStore/123-123-123",
            "deepCopy" : false
         }
      }
}

[edit] Other Design Notes