Introducing OpenTelemetry for Chargebee SDKs — trace every API call in any telemetry tool.

Add business rules to a ruleset

Adds one or more business rules to a ruleset without changing any of its other attributes. The rules are appended to the end of the ruleset's evaluation order, so you cannot choose their priorities here.

Use this operation to extend a ruleset that is already in use. Unlike Update a business ruleset, it leaves the rules already in the ruleset in place, so you do not need to resend the whole membership.

Prerequisites & Constraints

  • Each rule referenced in rules must already exist, and must not already belong to the ruleset.

Impacts

Business ruleset

The rules are appended to the end of the ruleset's evaluation order, each given a priority above the highest priority already in use, and updated_at and updated_by are set. The rules already in the ruleset keep their priorities, and the name, description, execute_mode, and active attributes of the ruleset are unchanged.

A rule can belong to more than one ruleset, so adding it here does not remove it from any other ruleset. A rule added to an active ruleset is evaluated only once the rule itself is also active.

Implementation Notes

Confirm the resulting evaluation order with List rules in a business ruleset, because this operation appends rather than inserting at a position you choose. If the new rules need to be evaluated earlier, set every priority explicitly with Update a business ruleset.

Sample Request

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/business_rulesets/{business-ruleset-id}/add_rules

Input Parameters

rules
optional

The business rules to add to the ruleset. Each entry takes the rule_id of an existing business rule. Pass the list as a JSON array.

To place a new rule earlier in the evaluation order, set the priorities explicitly with Update a business ruleset instead.

Impacts

  • Each rule is appended to the end of the ruleset's evaluation order, taking a priority above the highest already in use, in the order the entries appear in the array.
  • Rules already in the ruleset keep their priorities.

Constraints

  • Each rule_id must belong to a business rule that already exists.
  • A rule that is already in the ruleset cannot be added again.

Example → rules = [{"rule_id":"custom-uuid-3"},{"rule_id":"custom-uuid-4"}]

Returns

Business ruleset object

The business ruleset with the rules added to its membership. Its name, description, execute_mode, and active attributes are unchanged.