# Set an application's run mode.

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.

Endpoint: GET /WebApp/set_mode
Version: 11.138.0.10
Security: BasicAuth

## Query parameters:

  - `mode` (string, required)
    The run mode to set.
    Enum: "production", "development"

  - `name` (string, required)
    The application's unique name (slug).
    Example: "my-app"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "set_mode"

  - `module` (string)
    The name of the module called.
    Example: "WebApp"

  - `result` (object)

  - `result.data` (object)

  - `result.data.mode` (string)
    The application's run mode after the change.
    Enum: "production", "development"

  - `result.data.restarted` (integer)
    Whether the application's container was actually
recreated with the new mode in effect.

* 1 — Restarted; the new mode is live.
* 0 — The restart could not be completed. The
  mode is still recorded and takes effect on the
  next successful deploy, configure, or
  set_mode.
    Enum: 0, 1

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.metadata.error_category` (string,null)
    The machine-readable failure category. Only present
when status is 0.

* invalid_category — The action does not apply to the application's category.
* not_deployed — The application has not finished a deploy yet.
    Enum: "invalid_category", "not_deployed"

  - `result.status` (integer)
    - 1 - Success.
- 0 - Failed. Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


