Help Center/ ServiceStage/ API Reference/ Application Management V3 APIs/ Environment/ Modifying an Environment Based on the Environment ID
Updated on 2026-04-10 GMT+08:00

Modifying an Environment Based on the Environment ID

Function

This API is used to modify an environment based on the environment ID.

Authorization Information

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.

URI

PUT /v3/{project_id}/cas/environments/{environment_id}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Tenant's project ID. See Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

environment_id

Yes

String

Definition

Environment ID. See Obtaining All Environments.

Constraints

N/A

Range

N/A

Default Value

N/A

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Definition

Message body type (or format).

Constraints

N/A

Range

application/json;charset=utf8

Default Value

N/A

X-Auth-Token

Yes

String

Definition

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Environment name.

Range

The value contains 2 to 64 characters consisting of letters, digits, hyphens (-), or underscores (_). It starts with a letter and ends with a letter or digit. Letters are case sensitive.

Default Value

N/A

description

No

String

Definition

Environment description.

Range

The value can contain up to 128 characters.

Default Value

N/A

labels

No

Array of objects

Definition

Label. You can use TMS to filter resources by labels. See Table 4.

Constraints

Each environment can have a maximum of 20 labels.

Range

N/A

Default Value

N/A

enterprise_project_id

No

String

Definition

Enterprise project ID.

Constraints

An enterprise project can be configured only after the enterprise project function is enabled.

Range

N/A

Default Value

N/A

configuration

No

Object

Definition

Environment variable of the environment. See Table 5.

Table 4 labels

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Label name.

Labels are used to identify cloud resources. When you have multiple cloud resources of the same type, you can use labels to classify them based on usage, owner, or environment.

Range

The value contains 1 to 36 characters, including digits, letters, underscores (_), or hyphens (-).

Default Value

N/A

value

Yes

String

Definition

Label value.

Range

The value contains 1 to 43 characters, including digits, letters, underscores (_), periods (.), or hyphens (-).

Default Value

N/A

Table 5 configuration

Parameter

Mandatory

Type

Description

resource_envs

No

Array of objects

Definition

Resource variable bound to the environment. See Table 6.

envs

No

Array of objects

Definition

Environment variable of the environment. See Table 7.

Table 6 resource_env

Parameter

Mandatory

Type

Description

resource_id

Yes

String

Definition

ID of the resource associated with the resource variable bound to the environment.

Range

N/A

Default Value

N/A

resource_name

Yes

String

Definition

Name of the resource associated with the resource variable bound to the environment.

Range

N/A

Default Value

N/A

resource_type

Yes

String

Definition

Type of the resource associated with the resource variable bound to the environment.

Range

  • vpc
  • eip
  • elb
  • cce
  • ecs
  • as
  • cse: ServiceComb engine
  • nacos: registry/configuration center
  • dcs
  • rds
  • subnet
  • acl
  • customServer
  • gaussdb
  • dms_rocketmq
  • css_es: Elasticsearch
  • custom_k8s: custom Kubernetes cluster

Default Value

N/A

envs

Yes

Array of objects

Definition

Resource variable bound to the environment. See Table 7.

Table 7 config_env

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Key of the environment variable of the environment.

Range

N/A

Default Value

N/A

value

Yes

String

Definition

Value of the environment variable of the environment.

Range

N/A

Default Value

N/A

Response

Table 8 Response parameters

Parameter

Type

Description

id

String

Definition

Environment ID.

Range

N/A

name

String

Definition

Environment name.

Range

N/A

description

String

Definition

Environment description.

Range

N/A

project_id

String

Definition

Project ID.

Range

N/A

enterprise_project_id

String

Definition

Enterprise project ID.

Range

N/A

deploy_mode

String

Definition

Environment type.

Range

N/A

vpc_id

String

Definition

VPC ID.

Range

N/A

creator

String

Definition

Environment creator.

Range

N/A

create_time

Integer

Definition

Environment creation time.

Range

N/A

update_time

Integer

Definition

Environment update time.

Range

N/A

labels

Array of objects

Definition

Label. You can use TMS to filter resources by labels. See Table 9.

resources

Array of objects

Definition

Resource. See Table 10.

resource_create_mode

String

Definition

Resource configuration mode.

Range

  • none: resource management.

config_mode

String

Definition

Configuration mode.

Range

  • ui

configuration

Object

Definition

Environment variable of the environment. See Table 12.

Table 9 labels

Parameter

Type

Description

key

String

Definition

Label name.

Range

N/A

value

String

Definition

Label value.

Range

N/A

Table 10 resources

Parameter

Type

Description

id

String

Definition

Resource ID.

Range

N/A

name

String

Definition

Resource name.

Range

N/A

type

String

Definition

Resource type.

Range

  • vpc
  • eip
  • elb
  • cce
  • ecs
  • as
  • cse: ServiceComb engine
  • nacos: registry/configuration center
  • dcs
  • rds
  • subnet
  • acl
  • customServer
  • gaussdb
  • dms_rocketmq
  • css_es: Elasticsearch
  • custom_k8s: custom Kubernetes cluster

ip

String

Definition

IP address of the custom server when the resource type is set to customServer.

Range

N/A

parameters

Map<String, String>

Definition

Resource parameters. See Table 11.

alias

String

Definition

Resource alias.

Range

N/A

Table 11 parameters

Parameter

Type

Description

kube_config

String

Definition

Kubernetes connection configuration file.

This parameter is returned when the resource type is custom_k8s.

Range

N/A

Table 12 configuration

Parameter

Type

Description

resource_envs

Array of objects

Definition

Resource variable bound to the environment. See Table 13.

envs

Array of objects

Definition

Environment variable of the environment. See Table 14.

Table 13 resource_env

Parameter

Type

Description

resource_id

String

Definition

ID of the resource associated with the resource variable bound to the environment.

Range

N/A

resource_name

String

Definition

Name of the resource associated with the resource variable bound to the environment.

Range

N/A

resource_type

String

Definition

Type of the resource associated with the resource variable bound to the environment.

Range

  • vpc
  • eip
  • elb
  • cce
  • ecs
  • as
  • cse: ServiceComb engine
  • nacos: registry/configuration center
  • dcs
  • rds
  • subnet
  • acl
  • customServer
  • gaussdb
  • dms_rocketmq
  • css_es: Elasticsearch
  • custom_k8s: custom Kubernetes cluster

envs

Array of objects

Definition

Resource variable bound to the environment. See Table 14.

Table 14 config_env

Parameter

Type

Description

name

String

Definition

Key of the environment variable of the environment.

Range

N/A

value

String

Definition

Value of the environment variable of the environment.

Range

N/A

Example Request

Modify the environment name to development-env, leave the description blank, and add a label whose key-value pair is "test": "value" to the environment.

{
	"name": "development-env",
	"description": "",
        "labels": [
            {
                "key": "test",
                "value": "value"
            }
        ]
}

Example Response

{
	"id": "00078e9d-a61c-476e-ac63-a10c9cb2638e",
	"name": "development-env",
	"description": "",
	"project_id": "e7d2e9c589e5445e808a8ff0d1235aca",
	"enterprise_project_id": "0",
        "deploy_mode": "virtualmachine",
	"vpc_id": "29d55020-ae0e-4a18-871c-93e6976ee7bd",	
	"creator": "ss-test",
	"create_time": 1610418873730,
	"update_time": 1610418873730,
        "resources": [
            {
                "id": "329b135e-7b31-4ea6-afb9-b69017bd0a80",
                "type": "ecs",
                "name": "ecs-test"
            }
        ],
        "labels": [
            {
                "key": "test",
                "value": "value"
            }
        ]
}

Status Code

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

See ServiceStage Error Codes.