Skip to main content

Environments

Some Cherry Recommends resources can be organised into Environments. Environments are a global resource, and their purpose is only to group other resources. All tenants start with the 'default' environment. Environments enable you to separate different Customers, Items, Parameters, and Recommenders into groups. A common use of environments is to create a development and production environment.

Deleting environments

When you delete an environment, by default, all resources in that environment are transferred to the default environment. ID conflicts may prevent deletion.

How environment selection works

Functionally, environment selection is done using the x-environment header. The value of the header must be an integer and the internal id of the environment you wish to select. Not setting the x-environment header will select to the default environment.

const cherry = require("cherry.ai");

// set the default Id for all future calls.
// this injects the header `x-environment: 1` into all requests
cherry.environments.setDefaultEnvironmentId(1);

Limitations and known issues

Maximum number of environments

We currently restrict each tenant to have a maximum of 3 environments, plus the default.

Deleting Environments

Deleting environments may fail due to conflicts between environments. If this occurs, reach out for help.