-
Notifications
You must be signed in to change notification settings - Fork 19
Rest API
This page describes the current HTTP methods available to add, remove and list rules to the system. The rules are sent and returned from the REST API as JSON objects, as described in the rules wiki page
property | value |
---|---|
path | /v1/ |
verb | GET |
type | application/json |
To list the current rules on the CEP, you just call a GET on the path /v1/. That will return a JSON array of rules.
property | value |
---|---|
path | /v1/ |
verb | POST |
type | application/json |
body | JSON rule |
To add a new rule, send a POST request to /v1/. On the body of the request you must specify a single rule as JSON object. You will receive back a 200 status code if the rule was added, or a 400 status code along with an error description if the rule specified was invalid.
An example of a add request body would be:
{
"id": "rule1",
"input": ["inputTopic"],
"output": { "outputStream": "outputTopic" },
"executionPlan": "from inputTopic select fieldA, fieldB insert into outputStream"
}
That will return a 200 OK response if the rule rule1 is not already present on the system.
property | value |
---|---|
path | /v1/RULE_ID |
verb | DELETE |
type | application/json |
To delete a rule, send a DELETE request without body with the id from the rule that you want to remove on the request path. For example, if the rule test is already present and you want to remove it, send a DELETE request to /v1/test, and it will be removed. The API will respond with a 200 status code if the rule was deleted, or a 404 status code if the rule was not present.
property | value |
---|---|
path | /v1/synchronize |
verb | POST |
type | application/json |
body | JSON array with rules as JSON objects |
The synchronize lets you send a set of rules to the CEP. These rules will be synchronized with the set of rules that are already present on the system. At the end of the process, only the rules specified on the synchronize request will be present on the CEP.
Present rules that are not present on the request will be removed, new rules will be added, and rules that are present both on the system and on the CEP will be left untoched.