Skip to Content

Test the Business Rules API from SAP API Business Hub

test
0 %
Test the Business Rules API from SAP API Business Hub
Details
// Explore More Tutorials

Test the Business Rules API from SAP API Business Hub

Use SAP API Business Hub to test and run the business rules API to see how business rules can be consumed from a custom application.

You will learn

  • How to use Business Rules APIs
  • How to test Business Rules project

SAP Cloud Platform Business Rules REST APIs are available on SAP API Business Hub which lets you execute rules from custom applications and external REST Clients. Since these APIs are based on OAuth 2.0, you need the service key parameters to use the APIs.

Note the following parameters from the service keys of your business rules instance:

  • clientid
  • clientsecret
  • url
Configure environment
Step 1: Log onto SAP API Business Hub
  1. Log on to SAP API Business Hub

    API Hub Homepage
  2. In the search bar, search for Business rule. From the search results, select the API package for SAP Cloud Platform Business Rules.

    Search bar
  3. Choose the Rule Execution API for Cloud Foundry tile of Version v2.

    Rule Execution API tile
Log on to answer question
Step 2: Configure the environment

Here, you need to configure the environment to link it to the business rules project which you have created in Manage Rules Project application. Since Business Rules APIs are based on OAuth 2.0 authentication, you need to provide the authentication details too.

  1. Choose Configure Environments.

    Configure environment
  2. In the Configure Environments window, provide the following details:

    Field Name Value
    Display Name for Environments EU10
    runtimeurl bpmruleruntime.cfapps.eu10.hana.ondemand.com
    Client Id <clientid from service key>
    Secret <clientsecret from service key>
    tokenurl <url from service key>
    Configure environment

    Then, choose Save.

    Configure environment
Log on to answer question
Step 3: Invoke a rule service
  1. Select Invoke a Rule Service API and then choose /v2/workingset-rule-services. Then choose Try out to execute the API.

    Configure environment
  2. Fetch the rule service ID from Manage Rules Project application. This is required for the API JSON payload.

    In the Rule services tab, choose Settings icon.

    Configure environment

    Select ID and choose OK.

    Configure environment

    Copy the ID from the rule service.

    Configure environment
  3. Paste the rule service ID in place of <rule-service-ID> in the following JSON payload and copy it to the body of the API:

        {
      "RuleServiceId": "<rule-service-ID>",
      "Vocabulary": [
        {
          "Employee": {
            "isFullTimeEmployee": true,
            "countryofCompany": "USA",
            "jobTitle": "Engineer II",
             "company": "2000"
           }
        }
      ]
    }
    

    Then choose Execute.

    Configure environment
Log on to answer question
Step 4: Observe the API response

You can view the equipment assigned to the employee in the response body of the API.

Configure environment
How do you determine the OAuth 2.0 parameters required for configuring the environment on SAP API Business Hub?
×

Next Steps

Back to top