Create an On-Demand Sandbox

An on-demand sandbox (ODS) is a special B2C Commerce Instance used for development and testing purposes. Although ODS instances are only temporary, they can be made available for up to 90 days.

The code for your PWA Kit storefront doesn’t include info data about catalogs, customers, baskets, etc. To get that critical commerce data, it needs to request it from an ecommerce back end using headless APIs.

Most PWA Kit projects start with at least one on-demand sandbox to serve as a back end while developing the storefront code. Some development teams share a small number of sandboxes while others create many different sandboxes for different purposes.

Anyone with the Sandbox API User role in Account Manager can create an ODS. Because the role is scoped to a specific realm, you must know the four-character ID for your realm to create an ODS. If you don’t know your realm ID, ask your Account Executive (AE) or Customer Success Manager (CSM).

Also, you must know the client ID for sandbox creation—or have another administrator create one for you. If you don’t know the sandbox creation client ID, ask another B2C Commerce administrator on your team to share it with you. (Salesforce internal users can get the client ID from this Concierge article.)

To create an on-demand sandbox using B2C Commerce Developer Sandbox REST API:

  1. Go to the B2C Commerce Developer Sandbox REST API. (Salesforce internal users must use a different URL.)

  2. Click Authorize.

  3. Enter the client ID for sandbox creation.

  4. Click Authorize.

  5. Log in with your Account Manager credentials.

  6. To dismiss the authorization window and return to the Sandbox API user interface, click Close.

  7. In the Sandboxes section of the Sandbox API user interface, click to expand the POST/sandboxes method.

  8. Click Try it out.

  9. Delete the JSON object in the ProvisioningRequest field.

  10. Copy the following JSON object and paste it into the ProvisioningRequest field:

  11. Replace <your realm id> with your actual realm ID. Example: zzdc.

  12. If you want the sandbox to be available for more than 24 hours, replace the ttl value with any number of hours up to 2160 (90 days).

  13. You can also enter 0 or less for ttl to specify that the sandbox lasts until you delete it.

  14. Click Execute.

  15. If the ProvisioningRequest JSON is valid, a server response appears.

  16. Copy the response body or click Download so that you can refer to it later.

In the next section, you’ll need the Business Manager URL for your sandbox. The Business Manager URL can be found in the response body object in data.links.bm.

A Business Manager URL looks like this (but with its own unique hostname based on the realm ID and instance ID): https://zzdc-001.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site

More help with on-demand sandboxes is available on the B2C Commerce Infocenter: Get Started with On-Demand Sandboxes.

A more detailed Trailhead module is also available: Salesforce B2C Commerce On-Demand Sandboxes.

We recommend starting your PWA Kit project with a B2C Commerce instance that contains sample data.

To import sample data into an instance:

  1. Go to the Business Manager URL for your instance. (If you just created an ODS, it can take about 10 minutes for Business Manager to be available.)
  2. Log in with your Account Manager credentials.
  3. Go to Administration > Site Development > Site Import & Export.
  4. Select Storefront Reference Architecture Demo Sites.
  5. Click Import.
  6. Select Storefront Reference Architecture base.
  7. Click Deploy.
  8. Click Refresh to track the progress the deployment.

After the deployment process is complete (about 15 minutes), your instance will contain sample data that can be used while developing with PWA Kit.

After your sample data has finished deploying, rebuild your search indexes to reflect the new data:

  1. Go to the Business Manager URL for your instance.
  2. Log in with your Account Manager credentials.
  3. Go to Merchant Tools > Search Indexes.
  4. Select all of the indexes.
  5. Click Rebuild.

If you see broken catalog images on your PWA Kit storefront shortly after creating a new ODS, wait another 10 minutes or so for the issues to resolve on its own.

  • Now that you have an on-demand sandbox with sample data to work with, you’re ready to complete the next guide in the Get Started series: Set Up API Access.