Configure using REST services

You can use REST services for communication between components. For example at clean/deploy configuration, the ConfigurationRest service is used to clean/update the configuration for a component.

Rule Engine Server REST services

Rule Engine Server provides RESTful API to allow external systems to send REST calls for Rule Engine process operations, and status.

The following REST services are available for Rule Engine Server:

  • RuleEngineProcessRest - used to make a Rule Engine process operation.
  • URL: http://<host>:<port>/resrv-web/api/v1.0/process
  • The following operations are supported on this resource:
    • POST /api/v1.0/process - start a Rule Engine process operation
    • GET /api/v1.0/process/{taskId} - get the status of the process operation
  • RuleEngineStatusRest - used to get the status/clean the created Rule Engine Runtimes
  • URL: http://<host>:<port>/dsclient-web/api/v1.0/extract
  • The following operations are supported:
    • POST - clean the created Rule Engine Runtimes
    • GET - get the status of the created Rule Engine Runtimes

For details about REST services parameters, the Rule Engine Server RESTfull API documentation can be found at http://<host>:<port>/resrv-web/apidocs.

All REST services can be tested using Swagger UI at http://<host>:<port>/interplay-web/apidocs/ui.

Example for RuleEngineProcessRest call

POST request to http://localhost:9081/resrv-web/api/v1.0/process with the body:

{

"dataFile": "C:\\Axway\\AIS_2.2.0_RC2_R22\\AIS\\Samples\\AIS\\Finance1\\RuleEngine\\data\\IEvent.seq",

"configurationId": "ais",

"application": "default",

"collectionTypeName": "LOAN",

"collectionTypeVersion": "1"

}

GET request to http://localhost:9081/resrv-web/api/v1.0/process/1 for the response:

{

"taskId": "1",

"status": "FINISHED",

"success": true,

"collectionName": "LOAN",

"collectionVersion": "1",

"reports": [

{

"name": "dettrans.edi",

"path": "https://localhost:9081/resrv-web/download/001731ocf3v60imhbibpf746vdojet",

"type": "DEBUG"

},

{

"name": "transcnt.edi",

"path": "https://localhost:9081/resrv-web/download/00186db9epvge2jkri52t5ajoa2ug5",

"type": "STATISTICS"

},

{

"name": "cptrg.edi",

"path": "https://localhost:9081/resrv-web/download/00191a8k4l5oqvqtk412fmqpspsofa",

"type": "STATISTICS"

},

{

"name": "detano.edi",

"path": "https://localhost:9081/resrv-web/download/002104fk0ojhsfkok8l8irkkc1ks631",

"type": "REJECTS"

}],

"inputTraceResult": {

"name": "InputAudit",

"path": "https://localhost:9081/resrv-web/download/001226098n95o1hr67e27iftqlvbf9",

"outputType": "INPUT_AUDIT",

"propertyFile": null

},

"outputTraceResult": {

"name": "OutputAudit",

"path": "https://localhost:9081/resrv-web/download/001154bk2pt1jq0b0sbqjjm1dk9r5a",

"outputType": "OUTPUT_AUDIT",

"propertyFile": null

},

"outputResults": [

{

"name": "IAS",

"path": "https://localhost:9081/resrv-web/download/00132qnqe65c4tuej1sj87uev14a6p",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

},

{

"name": "LOCAL",

"path": "https://localhost:9081/resrv-web/download/0014459henqijnsnae7vgknrttugms",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

},

{

"name": "NULL_FEES",

"path": "https://localhost:9081/resrv-web/download/00151er1jedkfmvn3fsg4k0ja6kfq0",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

},

{

"name": "SESSION2",

"path": "https://localhost:9081/resrv-web/download/00165qhlirvdid08qd96sc25du6n0i",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

}]

}

The contents of the inputTraceResult can be accessed at https://localhost:9081/resrv-web/download/001226098n95o1hr67e27iftqlvbf9

Example for RuleEngineStatusRest call

GET request to http://localhost:9081/resrv-web/api/v1.0/status for the response:

{

"freeEnginesStatus": [

{

"applicationName": "default",

"aiConfigId": "aic1",

"aiConfigVersion": 6

}

],

"inUseEnginesStatus": [],

"profileName": "",

"processedOperations": 3,

"firstAccess": "2014-09-15 10:05:11",

"lastAccess": "2014-09-15 11:47:32"

}

Pooling mechanism

{

For example, for Rule Engine Server file processing, you must do a request to http://<host>:<port>/resrv-web/api/v1.0/process. The request format is:

{

"dataFile": "D:/ais-tools/ruleserver-tools/scanFolder/data/data/IEvent1.seq",

"configurationId": "aic2",

"application": "default",

"collectionTypeName": "LOAN",

"collectionTypeVersion": "1"

}

The request is processed and an asynchronous task and saved in the Repository database. The response contains the task identifier and the url used to check the status of the task.Using 315166 as the task identifier, the response is:

{

"taskId": "315166",

"resourceURI": "http://<host>:<port>/resrv-web/api/v1.0/process/315166"

}

The task status can be checked using resourceURI from the response: http://<host>:<port>/resrv-web/api/v1.0/process/315166.

If the task status is IN_PROGRESS, the response is:

{

"taskId": "315166",

"status": "IN_PROGRESS",

"reports": []

}

If the task status is FINISHED, the response is:

{

"taskId": "315166",

"status": "FINISHED",

"success": true,

"reports": [

{

"name": "RuleEngine.log",

"path": "/resrv-web/download/006315174196dvs19ckwwqgql1cjjc0o8znjlvqw",

"type": "DEBUG"

}

],

"collectionVersion": "1",

"reportsGenerated": true,

"outputResults": [

{

"name": "IAS",

"path": "/resrv-web/download/0063151708pvgk7how6iw2ay0k3h9qx1clgbqjaw",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

},

{

"name": "LOCAL",

"path": "/resrv-web/download/006315171ktn9zbog8cufwnr8y6rqlm2rlqilz60",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

},

{

"name": "NULL_FEES",

"path": "/resrv-web/download/006315172hn9j5vil80hpcwbolh9b5ck38aqsl93",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

},

{

"name": "SESSION2",

"path": "/resrv-web/download/006315173nb1vmcnzg1cax3bla15nf3ivohzue42",

"outputType": "OUTPUT_EVENT",

"propertyFile": null

}

],

"inputTraceResult": {

"name": "InputAudit",

"path": "/resrv-web/download/0063151699pqzz07yl790xl2i7316jsrlr1w56h9",

"outputType": "INPUT_AUDIT",

"propertyFile": null

},

"outputTraceResult": {

"name": "OutputAudit",

"path": "/resrv-web/download/0063151682qcy3rteedx1ec0u58krkbvwi03cak6",

"outputType": "OUTPUT_AUDIT",

"propertyFile": null

},

"collectionName": "LOAN"

}

The paths from the response can be used to:

Download the generated files

Send a request to the next component. For example,

{

"dataFile": "http://<host>:<port>/resrv- web/download/0063151682qcy3rteedx1ec0u58krkbvwi03cak6",

"collectionTypeName": "AUDIT_COLLECTION",

"collectionTypeVersion": "1",

"dsComponentName": "DatastoreRuntime"

}

Callback URL mechanism

Using the callback URL mechanism,you can set a callback URL in request(responseUri parameter) that is used to send a POST request with the result when the task is finished. The request is:

{

"dataFile": "D:/ais-tools/ruleserver-tools/scanFolder/data/data/IEvent1.seq",

"configurationId": "aic2",

"application": "default",

"collectionTypeName": "LOAN",

"collectionTypeVersion": "1",

"responseUri": "http://<host>:<port>/resrv-web/api/v1.0/processCallbackURL"

}

Rest service response message internationalization

If there is an error for a REST request, the response contains the errorCode parameters, and the message internationalized in the language from the request header. For example:

{

"error": {

"code": "error.inject.dsComponentName.notFound",

"message": {

"lang": "english",

"value": "The component with the name 'DatastoreRuntime' does not exist. ",

"parameters": [

"DatastoreRuntime"

]

}

}

}

After getting this response, you can either use the internationalized message or internationalize the message using errorCode and parameters.

Related Links