Introducing the Chargebee CLI

Update preferences

Updates one or more preferences and returns their resulting values.

Note: Changes are published when the update completes. The API does not create drafts.

Updating multiple preferences

You can update multiple preferences in a single request when they need to change together. The updates are applied atomically. If any entry fails validation, none of the changes take effect.

A synchronous request can include up to 25 entries. An asynchronous request can include up to 100 entries. Send Prefer: respond-async, chargebee-request-id, and chargebee-async-callback-url. See Required headers. Each variant entry counts toward this limit separately from its base entry.

You can update a preference and the preferences that depend on it in the same request. Applicability is checked against the configuration that would result from the complete update, not against the configuration before the update.

Before writing any changes, the API validates each entry:

  • The value against the preference's value_schema
  • The preference's applicability conditions against the resulting configuration
  • For variants, the value against the same value_schema and the criteria against the preference's criteria_schema

Variant entries

An entry without level and criteria updates the base value. An entry with both fields is a variant of that preference id.

A variant must include both level and criteria; sending only one is rejected. You can include the same id multiple times in a request: once for the base entry and once for each variant. A request that updates variants must include that id's base entry. A variant-only request is rejected.

To update an existing variant, use the same preference id and level. Include both value and criteria each time, even if only one has changed.

You can also update allow_override_in_interface when the preference definition has overridable_in_interface set to true. allow_override_in_api is read-only.

To add a new variant, use the next level after the current highest level. Levels must be 1, 2, 3, and so on, with no gaps. Include every lower level in the same request.

Sending the same id and level combination twice in one request, or the base entry for the same id twice, is rejected.

To keep the current override setting unchanged, omit allow_override_in_interface. Other fields in the entry can still change. If the preference has not been stored before, its initial override setting comes from the preference definitions.

Sample Request

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/preferences

Input Parameters

preferences[0..n]
Parameters for preferences. Multiple preferences can be passed by specifying unique indices.
pass parameters as preferences[<param name>][<idx:0..n>]

Returns

Preference object

Resource object representing preference