Updated on 2023-07-17 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.

APIG provides environment management, enabling you to access APIG 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": "0035dd2e76dd4e3fa45fef634318ada4",
	"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