i

Please enable JavaScript to view this site.

This example shows how to create a rule, show parameters, and execute it.

 

Rules Modeling for Examples

Step 1

 

Register an adapter of Standard Rule type.

 

 

V0016- H&M_ManUsu_ApiUserReglas_img1

 

Step 2

 

Model a “VATcalculation” rule with the suggested values.

 

 

Descriptive Name

VATcalculation          

Adapter

Standard Rule

JAVA code

VATvalue = (VATrate * Entryamount) / 100 ;

Totalamount = Inputamount + VATvalue ;

Input Parameters

VATrate

Inputamount

Output Parameters

VATvalue

Totalamount

 

 

In the properties panel, on the "General" tab, select the Deploy Rest API property. This option allows the rule to be consumed as Rest API externally.

 

 

V0016- H&M_ManUsu_ApiUserReglas_img3

 

Step 3

 

In the "Permissions" option, add the security function "Execute rule via Rest + RuleName" to a new permission, for example "ApiRestPermission".

 

 

V0016- H&M_ManUsu_ApiUserReglas_img2

Step 4

 

Assign to the previously created user the generated permission.

 

 

V0016- H&M_ManUsu_ApiUserReglas_img4

Rules Collection

 

Examples are implemented from Postman to execute each of the operations described in the following table. Previously, you must import the Rules collection

 

 

Operation

Description

getToken

Obtains token.

getParameters

Returns the input and output parameters of the rule.

execute

Executes the rule "VATcalculation" sending the fields "Inputamount" and "VATrate".

Returns "VATvalue" and "Totalamount".

 

Send us your comment
Share on Twitter Share on Linkedin Send by Email Print