WebApp
Web Apps

Set an application's run mode.

Changed on

This function sets an application's run mode, applies it to the container's environment (for example, NODE_ENV for a Node.js application), and recreates the container so the change takes effect immediately.

Important:

This function only applies to applications in the server category. Calling it on a static application fails with the invalid_category error category. It also requires the application to have finished at least one deploy; calling it before then fails with the not_deployed error category.

get/WebApp/set_mode

Request

  • Base URL
    https://cpanel-server.tld:2083/execute
  • Auth
    HTTP basic

Query parameters

mode'production' | 'development' required
Example:development

The run mode to set.

namestring required
Example:my-app

The application's unique name (slug).

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "set_mode",
  "module": "WebApp",
  "result": {
    "data": {
      "mode": "development",
      "restarted": 1
    },
    "status": 1
  }
}

Changes

    • warning

      added the new 0.00 enum value to the // response property for the response status

    • warning

      added the new not_deployed enum value to the // response property for the response status

    • info

      api operation id WebApp_set_mode removed and replaced with WebApp-set_mode