Updated on 2022-02-21 GMT+08:00

Creating an Environment

Function

API providers can publish an API in different environments, such as the development, test, and production environments. API information, such as the version, request address, and even request message, varies depending on the environment in which an API is published. For example, v1.0 of an API is published in the production environment, v1.1 in the test environment, and v1.2 in the development environment.

API Gateway provides environment management, enabling you to access API Gateway in different scenarios at minimal costs.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

POST

/v1.0/apigw/envs

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

name

Yes

String

Environment name

An environment name consists of 3–64 characters, starting with a letter. Only letters, digits, and underscores (_) are allowed.

remark

No

String

Description of the environment

The description cannot exceed 255 characters.

Example request:

{
	"name": "DEV",
	"remark": "Development environment"
}

Response

Table 3 Parameter description

Parameter

Type

Description

id

String

Environment ID

name

String

Environment name

create_time

Timestamp

Time when the environment is created

remark

String

Description of the environment

Example response:

{
	"id": "cca3616a-f368-4b32-9064-b2a631cb3eeb",
	"name": "DEV",
	"remark": "Development environment",
	"create_time": "2017-12-28T12:50:47.0744311Z"
}

Status Codes

Table 4 Status codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

500

Server Internal Error