Task 2: Deploying a RuleApp by using the REST API

You build the RuleApps using the Build Command tool, and then you deploy a RuleApp by using the REST API.

About this task

In this task, you do the following work:
  • Use the Build Command to create RuleApps.
  • Use the REST API to deploy a RuleApp.
  • Download a RuleApp archive.

Step 1: Building RuleApps by using the Build Command tool

You use the Build Command to create two RuleApps (see Automating builds with Build Command).

Procedure

  1. Open a command line window.
  2. Navigate to <InstallDir>/executionserver/tutorials/resruleappmanagement.
  3. Type ant buildRuleApps, and press Enter.

    This target uses the Build Command tool to create a RuleApp that is based on the decision service in the Rule Designer tutorial Creating a decision service with multiple projects. Then, the checkAmount action rule in the Loan Validation Check/rules/validation/loan folder is modified and another RuleApp is generated by using the Build Command.

    The two RuleApps are put in /resruleappmanagement/data/.

    Note: If the Ant task fails, see Setting up your environment to automate processes.

Step 2: Deploying a RuleApp archive

You deploy a RuleApp by using the REST API.

Procedure

  1. On the REST API tab, open the /ruleapps tab, and select POST - deployRuleAppArchive.
  2. In Request Body, browse to /resruleappmanagement/data/test_deployment.jar.
  3. Click Call method.
  4. In the Response area, ensure that HTTP Status 200 is displayed.
  5. On the Explorer tab, select the RuleApp test_deployment to display its two rulesets.
  6. Select the ruleset loan_validation_with_score_and_grade and click Show managed URI to display the associated XOM.

Step 3: Downloading the RuleApp archive

After the RuleApp is deployed, you can download it to an archive.

Procedure

  1. On the Explorer tab, select the RuleApp test_deployment.
  2. In the RuleApp view, click Download Archive. A compressed file of the RuleApp is downloaded to your computer.
  3. Save the archive to the /resruleappmanagement/work directory.

What to do next

In the next task, you test the ruleset in the Rule Execution Server console.