Drools Analytics supports integration of external REST API. After you add a REST service to a job, you can use it anywhere in the rule’s consequence, like a built-in scalar function. You must make sure that requests made to these services are secure. To achieve that you must add relevant authentication/authorization headers to your requests. For example, if you use AWS API Gateway protected with API Keys, you need to add “x-api-key” header with the key value. For example:

BinaryFile

The services must be declared using JAX-RS annotations. For example:

BinaryFile

Then the service should be declared in the rule file global com.test.MyService service; now it can be called service.hello("Bob", "Hi!");

To pass custom types to the service, these type must be declared first in Fact Types section.