Select Page

Please Mr. Postman

by | Last updated on Feb 21, 2023

“Please Mr. Postman” was a marvelous song by The Marvelettes from 1961.  Postman also happens to be a marvelous 3rd– party tool which I often use to test calling REST services.  This blog post will give a quick demonstration of using Postman to call InRule’s “out-of-the-box” irServer® Rule Execution Service using its REST endpoint, which can be installed using the InRule installer.

In this demonstration, I will first create a new rule application using irAuthor®, store it in irCatalog®, and then use Postman to execute the rule application using the irServer® Rule Execution Service.

Installing InRule

This demonstration will use three components, which are highlighted in the screen shot below:

Hello World!

We’ll start by authoring a simple rule application and storing it in the catalog.

Here are the steps I took to do this:

  • Launched irAuthor
  • On the Start page, clicked “New Rule Application”
  • On the Settings page, changed the name of the rule application from “NewRuleApplication” to “HelloWorld”
  • In the Entities pane, right-clicked on Entity1, and added a new field called Field1
  • Added a new rule to set the value of Field1 to “Hello World1”, as shown below
  • File-Save As, and saved the rule application to a local irCatalog service.

irAuthor

To save the rule application in irCatalog, I just select File->Save-As, and connect to my local irCatalog service.

I’ll now click the “Test” button to launch irVerify® and click the “Apply Rules” button to test out the rule.  As you can see below, it ran the rule and set Field1 to “Hello World!”

HelloWorld Rule

Calling irServer® Rule Execution Service from Postman

Postman can be downloaded here: https://www.getpostman.com/

To complete this demonstration, I just needed to launch Postman, and set up four things: the HTTP Method, the URL for my local irServer® Rule Execution Service instance, the Request, and Headers, as listed below:

The HTTP Method:

POST

The URL:

http://localhost/InRuleRuleEngineService/HttpService.svc/ApplyRules

The Body (using JSON):


{

"RuleApp": {

"RepositoryRuleAppRevisionSpec":{

"RuleApplicationName":"HelloWorld"

},

"UseIntegratedSecurity":"false",

"UserName":"Admin",

"Password":"password"

},

"RuleEngineServiceOptions": {

"Overrides": ""

},

"RuleEngineServiceOutputTypes": {

"ActiveNotifications": "false",

"ActiveValidations": "false",

"EntityState": "true",

"Overrides": "false",

"RuleExecutionLog": "false"

},

"EntityName": "Entity1",

"EntityState": "{}"

}

The Header:

Content-Type:application/json

Here is what Postman looks like just before clicking the Send button:

Postman

When clicking the Send button, Postman will POST the Request to the URL and get back a response.  Here is what Postman looks like after clicking the Send button, and as you can see, it did correctly run the rule and set Field1 to “Hello World!”

Postman Request

Here is the response I got back:

<RuleEngineHttpServiceResponse xmlns=”http://www.inrule.com/XmlSchema/Schema” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>

<ActiveNotifications/>

<ActiveValidations/>

<EntityState>{“Field1″:”Hello World!”}</EntityState>

<HasRuntimeErrors>false</HasRuntimeErrors>

<Overrides i:nil=”true”/>

<RequestId>00000000-0000-0000-0000-000000000000</RequestId>

<RuleExecutionLog i:nil=”true”/>

<RuleSessionState i:nil=”true”/>

<SessionId>b62c49ef-d8d9-4647-920a-4d4c63e05707</SessionId>

</RuleEngineHttpServiceResponse>

 Summary

In summary, although this blog post had nothing to do with the song “Please Mr. Postman,” it did show a simple demonstration of using Postman to call the irServer® Rule Execution Service.  Feel free to comment below if you have any thoughts or questions.

BLOG POSTS BY TOPIC:

FEATURED ARTICLES:

STAY UPDATED ON THE LATEST FROM INRULE

We'd love to send you monthly updates! Learn about our webinars and newly published content by subscribing to our emails. We'll never share your email address and you can easily unsubscribe at any time.