Rules/Execute

This method runs rules on a batch.

Files that are retrieved from the batch folder or sent to the batch folder are cached in a session folder on the Datacap Web Services server. When the web services session ends, the session folder is deleted. When the application closes, all folders are deleted.

The Execute POST method does not update batch attributes. If one of the values is changed by the rules, such as Priority, the batch attributes must be updated by using SaveBatchAttribute.

Caching is not required to run rules. If the BatchDir value is specified, the Datacap Web Services accesses the batch folder directly. The BatchDir value must be empty when the web.config setting enableCache is set to True to run rules against the files in the cache folder. If enableCache is set to False, you must specify a batch folder in BatchDir.

  • Result is not needed when you are posting. It is the result of rules execution. You can post with <Result></Result>.
  • If you post the TargetDCOObbject property as empty, the page is targeted.
  • ChildCondition is not needed when you are posting. It is the result of rules execution that is set by the action Task_RaiseCondition. ChildCondition can be empty or omitted when you post.
  • ChildrenQuantity is not needed when you are posting. It is the result of rules execution as set by the action Task_NumberOfSplits. ChildrenQuantity can be empty or omitted when you post.
  • XtraBatchFields are custom fields added to the Job Monitor. See Creating a custom column in the Job Monitor. The caller can use the SaveBatchAttribute endpoint to update the custom fields in the database after the actions change them. XtraBatchFields can be empty or omitted when you post. If actions need access to extra batch fields, the caller must pass XtraBatchFields, as in the following example.
      <XtraBatchFields>
         <KeyValueOfstringstring xmlns=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">
            <Key>pb_FieldA</Key>
            <Value>ValueA</Value>
         </KeyValueOfstringstring>
       </XtraBatchFields>
  • AllowOverride means that the actions are allowed to override failed validations. AllowOverride can be omitted when you are posting. If AllowOverride is included, the value must be set but it is not used. In the response, AllowOverride is set to False, if the action SetIsOverrideable is called with a parameter of False and a validation failed.
  • DocsInBatch is the number of documents in the batch, which you can find in the page file. DocsInBatch can be used by actions.
  • PagesInBatch is the number of pages in the batch, which you can find in the page file. PagesInBatch can be used by actions.
  • AppName (application name) and Workflow (workflow name) are not always the same.

URI

http://{IP address}:{Port}/ServicewTM.svc/Rules/Execute

Request content

The request content for this method runs the rules on a batch.

Response content

The response for this method contains the same content as the Request content.

This method returns one of the following response codes.
Table 1. Response codes for the POST Execute method
Response Code Description
200 OK The request was successful.
400 Bad Request The request was not understood by the service because of malformed syntax.
401 Unauthorized The request requires user authentication. If the request included valid credentials, the 401 response indicates that authorization was refused for those credentials.
405 Method Not Allowed The method that is specified in the Request-Line is not allowed for the resource that is identified by the Request-URI. The response must include an Allow header that contains a list of valid methods for the requested resource.
411 Length Required The service refuses to accept the request without a defined Content-Length. The client can repeat the request if it adds a valid Content-Length header field that contains the length of the message body in the request message.
500 Internal Error An unexpected condition was encountered that prevented the service from fulfilling the request.

POST Execute method JSON request example

{
   "Profile": "Verify",
   "Properties": {
      "AllowOverride": true,
      "AppName": "Flex",
      "BatchDir": "C:DatacapFlex\batches20140804.000000",
      "BatchID": "20140804.000000",
      "DCOFile": "Verify.xml",
      "DocsInBatch": 1,
      "JobName": "VSan-TIFF",
      "Operator": "admin",
      "PagesInBatch": 1,
      "Priority": 1,
      "Station": "1",
      "TaskName": "Verify",
      "Workflow": "Flex"
   }
}

POST Execute method XML request example

<RulesProperties>
  <Profile>Verify</Profile>
  <Properties>
    <AllowOverride>true</AllowOverride>
    <AppName>Flex</AppName>
    <BatchDir>C:\Datacap\Flex\batches\20140804.000000</BatchDir>
    <BatchID>20140804.000000</BatchID>
    <DCOFile>verify.xml</DCOFile>
    <DocsInBatch>1</DocsInBatch>
    <JobName>VScan-TIFF</JobName>
    <Operator>admin</Operator>
    <PagesInBatch>1</PagesInBatch>
    <Priority>1</Priority>
    <Station>1</Station>
    <TaskName>Verify</TaskName>
    <Workflow>Flex</Workflow>
  </Properties>
</RulesProperties>