Using the Managed Runtime API

The Managed Runtime API allows you to programmatically control apps deployed to Commerce Cloud’s Managed Runtime. It can be used to create custom tooling with the same basic functionality of the Runtime Admin web application, while offering you even more administration abilities and configuration options.

The Managed Runtime API is for administration purposes only. Do not make requests to the API in your storefront code.

What Is Mobify?

In this guide, the word “Mobify” appears in a few places. Mobify is the name of the company that originally developed the technology that became PWA Kit and Managed Runtime. In 2020, Salesforce acquired Mobify along with all of its technology.

The process of rebranding from Mobify to Salesforce is still ongoing. The Mobify brand name still appears in the mobify.com domain in the base URL for the Managed Runtime API. Although new Salesforce domains will eventually take the place of the Mobify domain, support for the Mobify domain will continue.

Before You Begin

This guide assumes that you're already familiar with the Managed Runtime and related concepts, such as: projects, environments, bundles, and deployments. To learn more, see the Managed Runtime Overview.

To make API requests, you must include an API key in the HTTP request Authorization header with the value, Bearer {{api_key}}.

To find your API key, log in to the Runtime Admin tool and go to the Account Settings page.

Treat your API key like a password because it allows scripts to perform operations on your behalf.

Tutorial

We’re about to show you how to use the API with a brief tutorial based on some sample requests, which are formatted as curl commands.

Before running the commands, replace any placeholders with actual values. Placeholders are formatted like this: {{placeholder}}.

For most requests, you must replace {{project_id}} with your actual project ID. To look up your project ID, log in to the Runtime Admin tool and go to your project’s settings page.

Project IDs can be up to 20 characters long and must be unique to the organization.

Working with Environments

Our first request to the Managed Runtime API lists all the environments (or "targets" as they're called in the API) that belong to a project:

Now let’s create an environment called staging that we can use to verify changes before deploying them to production:

To use your new environment, you must deploy a bundle to it.

Let’s review the details of the staging environment that we created:

Finally, let’s modify the proxy configuration for staging:

Changing the configuration causes the current bundle to be redeployed automatically so that the changes can take effect.

Troubleshooting

If you’re having trouble using the API try the following troubleshooting steps:

  • Add the --fail argument to your curl command.
  • Check your API key.
  • Check your project’s ID.

The API endpoints also work in a browser. Log in to the Runtime Admin tool then open the endpoint you’re using directly in your browser.

Next Steps

Now you’re familiar with what the API can do—and even made some sample requests! To learn more about the API, refer to the API Specification.