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

Update a business ruleset

Updates a business ruleset. Passing rules replaces the entire membership of the ruleset. To change membership incrementally, use Add business rules to a ruleset or Remove business rules from a ruleset instead.

Use this operation to rename a ruleset, to change the strategy in execute_mode, or to set the membership and priorities of the ruleset in one call.

Prerequisites & Constraints

Each rule referenced in rules must already exist.

Impacts

Business ruleset

The attributes you pass are updated, and updated_at and updated_by are set. When rules is passed, the membership of the ruleset becomes exactly the rules listed: rules that are not in the list are removed from the ruleset, and the priorities of the remaining rules are set from the list.

A rule dropped from the membership this way is not deleted. It remains available to other rulesets and can still be applied on its own.

Implementation Notes

Read the current membership with List rules in a business ruleset before passing rules, so that you do not drop a rule you meant to keep.

Sample Request

Sample Result[JSON]

URL Format

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

Input Parameters

name
required, string, max chars=500

Display name of the business ruleset. Include it even when you are only changing another attribute, such as execute_mode.

description
optional, string, max chars=1000

Description of what the business ruleset does.

execute_mode
optional, enumerated string, default=execute_all

Strategy that determines how the rules in the ruleset are evaluated and when evaluation stops.

Enum Values
stop_on_first_true

Evaluation stops as soon as a rule evaluates to true. The rules that come later in the evaluation order are not evaluated.

stop_on_first_false

Evaluation stops as soon as a rule evaluates to false. The rules that come later in the evaluation order are not evaluated.

execute_all

Every rule in the ruleset is evaluated and all the results are returned. This is the default.

execute_all_true

Every rule in the ruleset is evaluated, and only the rules that evaluated to true are returned.

rules
optional

The business rules that make up the ruleset, along with the priorities that determine their positions in its evaluation order. Each entry takes the rule_id of an existing business rule and an optional priority; when priority is omitted, it is assigned from the position of the entry in the array. Pass the list as a JSON array.

Constraints

  • Passing this parameter replaces the entire membership of the ruleset. To change the membership incrementally, use Add business rules to a ruleset or Remove business rules from a ruleset instead.
  • Each rule_id must belong to a business rule that already exists, and can appear only once in the list.
  • A priority can be used by only one rule in the ruleset. Two entries that carry the same priority are rejected.

Example → rules = [{"rule_id":"custom-uuid-1","priority":1},{"rule_id":"custom-uuid-2","priority":2}]

Returns

Business ruleset object

The updated business ruleset. When rules was passed, its membership is exactly the rules listed and the priorities of those rules are set from the list.