Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
fabianl
Product and Topic Expert
Product and Topic Expert
In the last Blog we´ve seen how easily we can access our data via the provided IoT service API.

Please check also the other Blogs if interesting:































  • Consume SAP CP IoT service Data via SAP CP Integration and check against SAP CP Business Rules Service (this blog)





I want to show u in the next 2/3 blogs how we ca use other SAP CP "pieces" to create finally an Sevice Ticket in SAP hybris Cloud for Service. The Motivation comes from the nice blogs from muralidaran.shanmugham2 about the user self-registration scenario for me it was clear we include now also the "SAP Cloud Platform Business Rules Service" in our scenario:

The final scenario looks like this little picture:



Lets begin.....

SAP Cloud Platform Business Rules


The first thing what wee need is to create an tiny rule the detail description is well documented on SAP Help. I think we need here not cover the complete process again, so i will only show some settings.

First we by accessing the "Business Rules Editor", the easiest way is to getting the URL by check the corresponding "Destination" in the "SCP Cockpit":



 

In the editor we just create a new rule, and the following two "Data Objects".
Temperature:


Alert Level:



Then we´ve created the rule with our conditions:



Afterwards we go ahead an define the Rule Service where we define the execution context, what comes in/what get´s out:



Finally we define our "Ruleset" and activate and deploy our "Rule Service".

Now we made a little test if our rule is working as aspected, for this we need first identify the "Buisness Rules Runtime URL" that we can identify via the "Destionations" in the SCP Cockpit:



Please check at this point the API documentation here.

And as u can see a prerequiste is first to fetch th XSRF token:



Than we can execute our "new" rule, the body were we define our request value (the temperature) looks like this:
{
"__type__": "Temperature",
"Temp": 5
}

And now we get our "result" as defined in our "rule":



Result:
{
"__type__": "AlertLevel",
"Level": "ERROR"
}

Ok that works as aspected now we move over to SAP CP Integration.

SAP Cloud Platform Integration


In short we want to define now an two iflows, which processing the following major steps:

  1. Call the SAP CP IoT service API

  2. Get the SAP CP Business Rules XSRF token

  3. Call the rule to compare the vaule against the rule

  4. Handle the result, in my case we start an little Workflow (details in the next blog)


To get the Values from IoT service we using here the following API:



Postman test:



The final Integration Flows looks like this:
Get IoT Values:


Compare against Busines Rules Service and start Workflow Services Instance:



Just easy and a working scenario.

In the next blog i would show you how the Workflow looks like.

 

Cheers,

fabian

 
3 Comments
Labels in this area