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.
|
Request Method |
URI |
|---|---|
|
POST |
/v1/{project_id}/apigw/instances/{instance_id}/envs |
The following table lists the parameters in the URI.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID, which can be obtained by the administrator on the My Credentials page. |
|
instance_id |
Yes |
String |
Instance ID, which can be obtained from the dedicated gateway information on the API Gateway console. |
Request
|
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
|
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
|
Status Code |
Description |
|---|---|
|
201 |
Created |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
500 |
Server Internal Error |
Last Article: Object Model
Next Article: Modifying an Environment
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.