< Previous | Next >

Task 2: Deploying a RuleApp by using the REST API

You deploy a RuleApp and its associated XOM by using the REST API.

About this task

You deploy the RuleApp, add a XOM resource, and then download the RuleApp archive.

Step 1: 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 <TutorialsDir>/resruleappmanagement/data/loanvalidation_for_resruleappmngt.jar.
  3. Click Call method.
  4. In the Response area, ensure that HTTP Status 200 is displayed.
  5. On the Explorer tab, display the RuleApps view and click the loanvalidation_for_resruleappmngt RuleApp

    On the RuleApp view, loanvalidation_for_resruleappmngt is now shown.

Step 2: Adding a XOM resource

You check whether loan-validation-xom.zip is available. If not, you deploy it.

Procedure

  1. Expand Resources in the navigation pane. If loan-validation-xom.zip is available, skip to step 3.
  2. On the REST API page, open the /xoms subpage, and select POST - deployResource.
  3. In Request Body, browse to /data/loan-validation-xom.zip.
  4. Set the xomname to loan-validation-xom.zip.
  5. Click Call method.
  6. On the Explorer tab, the loan-validation-xom.zip/1.0 is listed under Resources.

Step 3: Setting up a ruleset-managed URI with the XOM resource

You add references to the URI of the managed XOM resource by using the REST API.

Procedure

  1. On the REST API tab, open the /ruleapps tab, and select POST - addRulesetProperty.
    Tip: Use the browser search to find the addRulesetProperty method.
  2. Set the request parameters:
    • Request Body: resuri://loan-validation-xom.zip/1.0
    • ruleappname: loanvalidation_for_resruleappmngt
    • ruleappversion: 1.0
    • rulesetname: loan_validation_with_score_and_grade
    • rulesetversion: 1.0
    • propertyname: ruleset.managedxom.uris
  3. Click Call method.
  4. On the Explorer tab, expand RuleApps/loanvalidation_for_resruleappmngt/1.O in the navigator and select the loan_validation_with_score_and_grade ruleset. In the ruleset view, expand Show Managed URIs. The resource URI is set.

Step 4: 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 loanvalidation_for_resruleappmanet.
  2. In the RuleApp View, click Download Archive next to the green arrow.

    If you are using the Firefox browser, right-click Download Archive and select Save Link As instead.

  3. Save the archive to the <TutorialsDir>/resruleappmanagement/work directory.
  4. If necessary, close the Save dialog box.

What to do next

In the next task, you test the ruleset in the Rule Execution Server console.
< Previous | Next >