API Documentation

Comprehensive REST API reference for the Beas Rule Engine

Overview

The Beas Rule Engine provides a comprehensive REST API for rule management and evaluation. This document describes all available endpoints, their parameters, and response formats.

Base URL
http://localhost:8070/beasre/v1

Authentication

All API endpoints require OAuth2 authentication using JWT tokens. Include the token in the Authorization header:

Authorization: Bearer <your-jwt-token>

Rule Engine Operations

POST /rule-engine/evaluate
Evaluate Rule

Evaluates a rule with the provided parameters and payload.

Request Body:
{
  "ruleName": "string",
  "parameters": {
    "key1": "value1",
    "key2": "value2"
  },
  "payload": {
    "data": "value"
  }
}
Query Parameters:
  • param1, param2, etc. - Additional parameters to include in rule context
Response:
{
  "response": {
    "result": "value",
    "message": "string"
  },
  "status": {
    "message": "OK",
    "description": "Validation Executed"
  }
}
Example:
curl -X POST "http://localhost:8070/beasre/v1/rule-engine/evaluate?customerType=premium" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "ruleName": "discount-rule",
    "parameters": {
      "orderAmount": 1000
    },
    "payload": {
      "orderId": "12345",
      "items": ["item1", "item2"]
    }
  }'
GET /rule-engine/sync
Sync Caches

Synchronizes all rule engine caches asynchronously.

Response:

HTTP 200 OK

Example:
curl -X GET "http://localhost:8070/beasre/v1/rule-engine/sync" \
  -H "Authorization: Bearer your-token"

Rule Library Management

GET /rule-library
Get All Rule Libraries

Retrieves all rule libraries with optional filtering.

Query Parameters:
  • filter - RSQL filter expression
  • sort - Sort field (e.g., "name,asc")
  • page - Page number (0-based)
  • size - Page size
Response:
{
  "content": [
    {
      "id": "uuid",
      "name": "string",
      "description": "string",
      "mvlCode": "string",
      "functions": ["string"],
      "helpers": ["string"],
      "containerName": "string",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ],
  "totalElements": 10,
  "totalPages": 1,
  "size": 20,
  "number": 0
}
GET /rule-library/{id}
Get Rule Library by ID

Retrieves a specific rule library by its ID.

Path Parameters:
  • id - Rule library UUID
Response:

Rule library object

POST /rule-library
Create Rule Library

Creates a new rule library.

Request Body:
{
  "name": "string",
  "description": "string",
  "mvlCode": "string",
  "functions": ["string"],
  "helpers": ["string"],
  "containerName": "string"
}
Response:

Created rule library object

PUT /rule-library/{id}
Update Rule Library

Updates an existing rule library.

Path Parameters:
  • id - Rule library UUID
Request Body:

Rule library object

Response:

Updated rule library object

DELETE /rule-library/{id}
Delete Rule Library

Deletes a rule library.

Path Parameters:
  • id - Rule library UUID
Response:

HTTP 204 No Content

Function Library Management

GET /function-library
Get All Function Libraries

Retrieves all function libraries.

Query Parameters:

Same as rule library

Response:

Paginated function library list

GET /function-library/{id}
Get Function Library by ID

Retrieves a specific function library.

Path Parameters:
  • id - Function library UUID
Response:

Function library object

POST /function-library
Create Function Library

Creates a new function library.

Request Body:
{
  "name": "string",
  "description": "string",
  "functionCode": "string",
  "containerName": "string"
}
Response:

Created function library object

PUT /function-library/{id}
Update Function Library

Updates an existing function library.

Path Parameters:
  • id - Function library UUID
Request Body:

Function library object

Response:

Updated function library object

DELETE /function-library/{id}
Delete Function Library

Deletes a function library.

Path Parameters:
  • id - Function library UUID
Response:

HTTP 204 No Content

Rule Helper Management

GET /rule-helper
Get All Rule Helpers

Retrieves all rule helpers with optional filtering.

Query Parameters:

Same as rule library

Response:

Paginated rule helper list

GET /rule-helper/{id}
Get Rule Helper by ID

Retrieves a specific rule helper.

Path Parameters:
  • id - Rule helper UUID
Response:

Rule helper object

POST /rule-helper
Create Rule Helper

Creates a new rule helper.

Request Body:
{
  "name": "string",
  "description": "string",
  "helperCode": "string",
  "containerName": "string"
}
Response:

Created rule helper object

PUT /rule-helper/{id}
Update Rule Helper

Updates an existing rule helper.

Path Parameters:
  • id - Rule helper UUID
Request Body:

Rule helper object

Response:

Updated rule helper object

DELETE /rule-helper/{id}
Delete Rule Helper

Deletes a rule helper.

Path Parameters:
  • id - Rule helper UUID
Response:

HTTP 204 No Content