REST

Get started using the RESTful interface by pointing your app (a browser will do) at /rulesEngine/rest/applyRules and add a couple of parameters like:
  • ruleSet=Means Test
  • income=900
  • expenses=400

-> /rulesEngine/rest/applyRules?ruleSet=Means Test&facts=[{income:900,expenses:400}]

You can GET or POST your facts to the rules engine as JSON, and it will return a JSON map/object of the results.

If you're a masochist you can post the facts as (encoded) XML and get XML results. e.g.

<list> <map> <entry key="income">900</entry> <entry key="expenses">400</entry> </map> </list>

-> /rulesEngine/rest/applyRules?ruleSet=Means%20Test&facts=%20%3Clist%3E%3Cmap%3E%3Centry%20key=%22income%22%3E900%3C/entry%3E%3Centry%20key=%22expenses%22%3E400%3C/entry%3E%3C/map%3E%3C/list%3E

If you use POST you can do a call as pure JSON or XML using the contentType e.g. application/json or text/xml. So you can just post {ruleSet: 'Questions', facts: [{code: '428606'}]} using contentType application/json then you'll get back a JSON response.

screenshot1.png
Example of using JSON encoded post in the poster plugin for firefox.
To send a REST call as XML you'd sendthe following with the contentType set to text/xml.
<params>
<ruleSet>Means Test</ruleSet>
<facts>
<list>
<map>
<entry key="income">900</entry>
<entry key="expenses">300</entry>
</map>
</list>
</facts>
</params>

screenshot2.png
Sending an XML REST request to One Ring via Poster.


Copyright © nerdErg Pty Ltd 2012 ABN 20 159 294 989