Modifying an API
Function
This API is used to modify the information about an API, including its backend information.
Debugging
You can use API Explorer to debug this API.
URI
PUT /v2/{project_id}/apigw/instances/{instance_id}/apis/{api_id}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see "Appendix" > "Obtaining a Project ID" in this document. |
|
instance_id |
Yes |
String |
Gateway ID. |
|
api_id |
Yes |
String |
API ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token, which can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
API name. An API name can contain 3 to 64 characters, starting with a letter. Only letters, digits, and underscores (_) are allowed. Chinese characters must be in UTF-8 or Unicode format. |
|
type |
Yes |
Integer |
API type.
Enumeration values:
|
|
version |
No |
String |
API version. Maximum: 16 |
|
req_protocol |
Yes |
String |
Request protocol.
Default: HTTPS Enumeration values:
|
|
req_method |
Yes |
String |
Request method. Enumeration values:
|
|
req_uri |
Yes |
String |
Request address, which can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (*), percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply with URI specifications. The request address must comply with URI specifications. |
|
auth_type |
Yes |
String |
Security authentication mode.
Enumeration values:
|
|
auth_opt |
No |
AuthOpt object |
Security authentication parameter. |
|
cors |
No |
Boolean |
Indicates whether CORS is supported.
Default: false Enumeration values:
|
|
match_mode |
No |
String |
Route matching mode.
The default value is NORMAL. Enumeration values:
|
|
backend_type |
Yes |
String |
Backend type.
Enumeration values:
|
|
remark |
No |
String |
Description of the API, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
group_id |
Yes |
String |
ID of the API group to which the API belongs. |
|
body_remark |
No |
String |
API request body, which can be an example request body, media type, or parameters. Ensure that the request body does not exceed 20,480 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
result_normal_sample |
No |
String |
Example response for a successful request. Ensure that the response does not exceed 20,480 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
result_failure_sample |
No |
String |
Example response for a failed request. Ensure that the response does not exceed 20,480 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
authorizer_id |
No |
String |
ID of the frontend custom authorizer. |
|
tags |
No |
Array of strings |
Tags. The value can contain only letters, digits, and underscores (_), and must start with a letter. You can enter multiple tags and separate them with commas (,). Minimum: 1 Maximum: 128 |
|
response_id |
No |
String |
Group response ID. |
|
roma_app_id |
No |
String |
Integration application ID. This parameter is currently not supported. |
|
domain_name |
No |
String |
Custom domain name bound to the API. This parameter is currently not supported. |
|
tag |
No |
String |
Tag. This field will be deprecated. You can use the tags field instead. |
|
content_type |
No |
String |
Request content type: application/json application/xml multipart/form-date text/plain Currently, this parameter is not supported. Enumeration values:
|
|
mock_info |
No |
ApiMockCreate object |
Name of the integration application to which the API belongs. |
|
func_info |
No |
ApiFuncCreate object |
FunctionGraph backend details. |
|
req_params |
No |
Array of ReqParamBase objects |
Request parameters. |
|
backend_params |
No |
Array of BackendParamBase objects |
Backend parameters. |
|
policy_mocks |
No |
Array of ApiPolicyMockCreate objects |
Mock policy backends. |
|
policy_functions |
No |
Array of ApiPolicyFunctionCreate objects |
FunctionGraph policy backends. |
|
backend_api |
No |
BackendApiCreate object |
Web backend details. |
|
policy_https |
No |
Array of ApiPolicyHttpCreate objects |
Web policy backends. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
app_code_auth_type |
No |
String |
Indicates whether AppCode authentication is enabled. This parameter is valid only if auth_type is set to App. The default value is DISABLE.
Default: DISABLE Enumeration values:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
remark |
No |
String |
Description, which can contain a maximum of 255 characters. |
|
result_content |
No |
String |
Currently, this parameter is not supported. |
|
version |
No |
String |
ID of the corresponding custom backend API. |
|
authorizer_id |
No |
String |
Backend custom authorizer ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
function_urn |
Yes |
String |
Function URN. |
|
remark |
No |
String |
Description about the backend, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
invocation_type |
Yes |
String |
Invocation mode.
Enumeration values:
|
|
version |
No |
String |
Function version. Maximum: 64 |
|
timeout |
Yes |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
authorizer_id |
No |
String |
Backend custom authorizer ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Parameter name. The parameter name can contain 1 to 32 characters and must start with a letter. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. |
|
type |
Yes |
String |
Parameter type. Enumeration values:
|
|
location |
Yes |
String |
Parameter location. Enumeration values:
|
|
default_value |
No |
String |
Default value. |
|
sample_value |
No |
String |
Example value. |
|
required |
No |
Integer |
Indicates whether the parameter is required. 1: yes 2: no The value of this parameter is 1 if Location is set to PATH, and 2 if Location is set to another value. Enumeration values:
|
|
valid_enable |
No |
Integer |
Indicates whether validity check is enabled.
Default: 2 Enumeration values:
|
|
remark |
No |
String |
Description about the backend, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
enumerations |
No |
String |
Enumerated value. |
|
min_num |
No |
Integer |
Minimum value. This parameter is valid when type is set to NUMBER. |
|
max_num |
No |
Integer |
Maximum value. This parameter is valid when type is set to NUMBER. |
|
min_size |
No |
Integer |
Minimum length. This parameter is valid when type is set to STRING. |
|
max_size |
No |
Integer |
Maximum length. This parameter is valid when type is set to STRING. |
|
regular |
No |
String |
Regular expression validation rule. This parameter is currently not supported. |
|
json_schema |
No |
String |
JSON validation rule. This parameter is currently not supported. |
|
pass_through |
No |
Integer |
Indicates whether to transparently transfer the parameter. 1: yes 2: no Enumeration values:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
result_content |
No |
String |
Separate the time of multiple publication records with vertical bars (|). |
|
effect_mode |
Yes |
String |
Effective mode of the backend policy.
Enumeration values:
|
|
name |
Yes |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
|
backend_params |
No |
Array of BackendParamBase objects |
Backend parameters. |
|
conditions |
Yes |
Array of ApiConditionBase objects |
Policy conditions. |
|
authorizer_id |
No |
String |
ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
function_urn |
Yes |
String |
Function URN. |
|
invocation_type |
Yes |
String |
Invocation mode.
Enumeration values:
|
|
version |
No |
String |
Function version Ensure that the version does not exceed 64 characters. |
|
timeout |
No |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
effect_mode |
Yes |
String |
Effective mode of the backend policy.
Enumeration values:
|
|
name |
Yes |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
|
backend_params |
No |
Array of BackendParamBase objects |
Backend parameters. |
|
conditions |
Yes |
Array of ApiConditionBase objects |
Policy conditions. |
|
authorizer_id |
No |
String |
ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
authorizer_id |
No |
String |
Backend custom authorizer ID. |
|
url_domain |
No |
String |
Backend service address. A backend service address consists of a domain name or IP address and a port number, with not more than 255 characters. It must be in the format "Host name:Port number", for example, apig.example.com:7443. If the port number is not specified, the default HTTPS port 443 or the default HTTP port 80 is used. The backend service address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
|
req_protocol |
Yes |
String |
Request protocol. Enumeration values:
|
|
remark |
No |
String |
Description, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
req_method |
Yes |
String |
Request method. Enumeration values:
|
|
version |
No |
String |
Web backend version, which can contain a maximum of 16 characters. |
|
req_uri |
Yes |
String |
Request address, which can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (), percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply with URI specifications. The request address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables. The request address must comply with URI specifications. |
|
timeout |
Yes |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
enable_client_ssl |
No |
Boolean |
Indicates whether to enable two-way authentication. |
|
vpc_channel_info |
No |
ApiBackendVpcReq object |
VPC channel details. This parameter is required if vpc_channel_status is set to 1. |
|
vpc_channel_status |
No |
Integer |
Indicates whether to use a VPC channel.
Enumeration values:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
vpc_channel_proxy_host |
No |
String |
Proxy host. |
|
vpc_channel_id |
Yes |
String |
VPC channel ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
url_domain |
No |
String |
Endpoint of the policy backend. An endpoint consists of a domain name or IP address and a port number, with not more than 255 characters. It must be in the format "Domain name:Port number", for example, apig.example.com:7443. If the port number is not specified, the default HTTPS port 443 or the default HTTP port 80 is used. The endpoint can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
|
req_protocol |
Yes |
String |
Request protocol. The value can be HTTP or HTTPS. Enumeration values:
|
|
req_method |
Yes |
String |
Request method. Enumeration values:
|
|
req_uri |
Yes |
String |
Request address, which can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (), percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply with URI specifications. The request address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables. The request address must comply with URI specifications. |
|
timeout |
No |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
effect_mode |
Yes |
String |
Effective mode of the backend policy.
Enumeration values:
|
|
name |
Yes |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
|
backend_params |
No |
Array of BackendParamBase objects |
Backend parameters. |
|
conditions |
Yes |
Array of ApiConditionBase objects |
Policy conditions. |
|
authorizer_id |
No |
String |
ID. |
|
vpc_channel_info |
No |
ApiBackendVpcReq object |
VPC channel details. This parameter is required if vpc_channel_status is set to 1. |
|
vpc_channel_status |
No |
Integer |
Indicates whether to use a VPC channel.
Enumeration values:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
origin |
Yes |
String |
Parameter type.
Enumeration values:
|
|
name |
Yes |
String |
Parameter name. The parameter name must start with a letter and can only contain letters, digits, hyphens (-), underscores (_), and periods (.). Minimum: 1 Maximum: 32 |
|
remark |
No |
String |
Description, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
location |
Yes |
String |
Parameter location. The value can be PATH, QUERY, or HEADER. Enumeration values:
|
|
value |
Yes |
String |
Parameter value, which can contain a maximum of 255 characters. If the origin type is REQUEST, the value of this parameter is the parameter name in req_params. If the origin type is CONSTANT, the value is a constant. If the origin type is SYSTEM, the value is a system parameter name. System parameters include gateway parameters, frontend authentication parameters, and backend authentication parameters. You can set the frontend or backend authentication parameters after enabling custom frontend or backend authentication. The gateway parameters are as follows:
Frontend authentication parameter: prefixed with "$context.authorizer.frontend.". For example, to return "aaa" upon successful custom authentication, set this parameter to "$context.authorizer.frontend.aaa". Backend authentication parameter: prefixed with "$context.authorizer.backend.". For example, to return "aaa" upon successful custom authentication, set this parameter to "$context.authorizer.backend.aaa". |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
req_param_name |
No |
String |
Input parameter name. This parameter is required if the policy type is param. |
|
condition_type |
No |
String |
Policy condition.
This parameter is required if the policy type is param. Enumeration values:
|
|
condition_origin |
Yes |
String |
Policy type.
Enumeration values:
|
|
condition_value |
Yes |
String |
Condition value. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
API name. An API name can contain 3 to 64 characters, starting with a letter. Only letters, digits, and underscores (_) are allowed. Chinese characters must be in UTF-8 or Unicode format. |
|
type |
Integer |
API type.
Enumeration values:
|
|
version |
String |
API version. Maximum: 16 |
|
req_protocol |
String |
Request protocol.
Default: HTTPS Enumeration values:
|
|
req_method |
String |
Request method. Enumeration values:
|
|
req_uri |
String |
Request address, which can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (*), percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply with URI specifications. The request address must comply with URI specifications. |
|
auth_type |
String |
Security authentication mode.
Enumeration values:
|
|
auth_opt |
AuthOpt object |
Security authentication parameter. |
|
cors |
Boolean |
Indicates whether CORS is supported.
Default: false Enumeration values:
|
|
match_mode |
String |
Route matching mode.
The default value is NORMAL. Enumeration values:
|
|
backend_type |
String |
Backend type.
Enumeration values:
|
|
remark |
String |
Description of the API, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
group_id |
String |
ID of the API group to which the API belongs. |
|
body_remark |
String |
API request body, which can be an example request body, media type, or parameters. Ensure that the request body does not exceed 20,480 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
result_normal_sample |
String |
Example response for a successful request. Ensure that the response does not exceed 20,480 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
result_failure_sample |
String |
Example response for a failed request. Ensure that the response does not exceed 20,480 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
authorizer_id |
String |
ID of the frontend custom authorizer. |
|
tags |
Array of strings |
Tags. The value can contain only letters, digits, and underscores (_), and must start with a letter. You can enter multiple tags and separate them with commas (,). Minimum: 1 Maximum: 128 |
|
response_id |
String |
Group response ID. |
|
roma_app_id |
String |
Integration application ID. This parameter is currently not supported. |
|
domain_name |
String |
Custom domain name bound to the API. This parameter is currently not supported. |
|
tag |
String |
Tag. This field will be deprecated. You can use the tags field instead. |
|
content_type |
String |
Request content type: application/json application/xml multipart/form-date text/plain Currently, this parameter is not supported. Enumeration values:
|
|
id |
String |
API ID. |
|
status |
Integer |
API status.
|
|
arrange_necessary |
Integer |
Indicates whether to enable orchestration. |
|
register_time |
String |
Time when the API is registered. |
|
update_time |
String |
Time when the API was last modified. |
|
group_name |
String |
Name of the API group to which the API belongs. |
|
group_version |
String |
Version of the API group to which the API belongs. The default value is V1. Other versions are not supported. Default: V1 |
|
run_env_id |
String |
ID of the environment in which the API has been published. Separate multiple environment IDs with vertical bars (|). |
|
run_env_name |
String |
Name of the environment in which the API has been published. Separate multiple environment names with vertical bars (|). |
|
publish_id |
String |
Publication record ID. Separate multiple publication record IDs with vertical bars (|). |
|
publish_time |
String |
Time when the API is published. Separate the time of multiple publication records with vertical bars (|). |
|
roma_app_name |
String |
Name of the integration application to which the API belongs. Currently, this parameter is not supported. |
|
ld_api_id |
String |
ID of the corresponding custom backend API. Currently, this parameter is not supported. |
|
backend_api |
BackendApi object |
Web backend details. |
|
api_group_info |
ApiGroupCommonInfo object |
API group information. |
|
func_info |
ApiFunc object |
FunctionGraph backend details. |
|
mock_info |
ApiMock object |
Currently, this parameter is not supported. |
|
req_params |
Array of ReqParam objects |
Publication record ID. |
|
backend_params |
Array of BackendParam objects |
Backend parameters. |
|
policy_functions |
Array of ApiPolicyFunctionResp objects |
Separate multiple publication record IDs with vertical bars (|). |
|
policy_mocks |
Array of ApiPolicyMockResp objects |
Time when the API is published. |
|
policy_https |
Array of ApiPolicyHttpResp objects |
Web policy backends. |
|
Parameter |
Type |
Description |
|---|---|---|
|
app_code_auth_type |
String |
Indicates whether AppCode authentication is enabled. This parameter is valid only if auth_type is set to App. The default value is DISABLE.
Default: DISABLE Enumeration values:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
authorizer_id |
String |
Backend custom authorizer ID. |
|
url_domain |
String |
Backend service address. A backend service address consists of a domain name or IP address and a port number, with not more than 255 characters. It must be in the format "Host name:Port number", for example, apig.example.com:7443. If the port number is not specified, the default HTTPS port 443 or the default HTTP port 80 is used. The backend service address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
|
req_protocol |
String |
Request protocol. Enumeration values:
|
|
remark |
String |
Description, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
req_method |
String |
Request method. Enumeration values:
|
|
version |
String |
Web backend version, which can contain a maximum of 16 characters. |
|
req_uri |
String |
Request address, which can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (), percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply with URI specifications. The request address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables. The request address must comply with URI specifications. |
|
timeout |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
enable_client_ssl |
Boolean |
Indicates whether to enable two-way authentication. |
|
id |
String |
ID. |
|
status |
Integer |
Backend service status.
|
|
register_time |
String |
Registration time. |
|
update_time |
String |
Update time. |
|
vpc_channel_info |
VpcInfo object |
VPC channel details. This parameter is required if vpc_channel_status is set to 1. |
|
vpc_channel_status |
Integer |
Indicates whether to use a VPC channel.
|
|
Parameter |
Type |
Description |
|---|---|---|
|
ecs_id |
String |
Cloud server ID. |
|
ecs_name |
String |
Cloud server name. |
|
cascade_flag |
Boolean |
Indicates whether to use the cascading mode. This parameter is currently not supported. |
|
vpc_channel_proxy_host |
String |
Proxy host. |
|
vpc_channel_id |
String |
VPC channel ID. |
|
vpc_channel_port |
Integer |
VPC channel port. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
ID. |
|
name |
String |
API group name. |
|
status |
Integer |
Status.
Enumeration values:
|
|
sl_domain |
String |
Automatically allocated subdomain name. |
|
register_time |
String |
Creation time. |
|
update_time |
String |
Last modification time. |
|
on_sell_status |
Integer |
Indicates whether the API group has been listed on the Marketplace.
|
|
url_domains |
Array of UrlDomain objects |
Independent domain names bound to the API group. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Domain ID. |
|
domain |
String |
Domain name. |
|
cname_status |
Integer |
CNAME resolution status of the domain name.
|
|
ssl_id |
String |
SSL certificate ID. |
|
ssl_name |
String |
SSL certificate name. |
|
min_ssl_version |
String |
Minimum SSL version. TLS 1.1 and TLS 1.2 are supported. Default: TLSv1.1 Enumeration values:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
function_urn |
String |
Function URN. |
|
remark |
String |
Description about the backend, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
invocation_type |
String |
Invocation mode.
Enumeration values:
|
|
version |
String |
Function version. Maximum: 64 |
|
timeout |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
authorizer_id |
String |
Backend custom authorizer ID. |
|
id |
String |
ID. |
|
register_time |
String |
Registration time. |
|
status |
Integer |
Backend service status.
|
|
update_time |
String |
Update time. |
|
Parameter |
Type |
Description |
|---|---|---|
|
remark |
String |
Description, which can contain a maximum of 255 characters. |
|
result_content |
String |
Currently, this parameter is not supported. |
|
version |
String |
ID of the corresponding custom backend API. |
|
authorizer_id |
String |
Backend custom authorizer ID. |
|
id |
String |
Backend information. |
|
register_time |
String |
API group information. |
|
status |
Integer |
Backend service status.
|
|
update_time |
String |
Update time. |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Parameter name. The parameter name can contain 1 to 32 characters and must start with a letter. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. |
|
type |
String |
Parameter type. Enumeration values:
|
|
location |
String |
Parameter location. Enumeration values:
|
|
default_value |
String |
Default value. |
|
sample_value |
String |
Example value. |
|
required |
Integer |
Indicates whether the parameter is required. 1: yes 2: no The value of this parameter is 1 if Location is set to PATH, and 2 if Location is set to another value. Enumeration values:
|
|
valid_enable |
Integer |
Indicates whether validity check is enabled.
Default: 2 Enumeration values:
|
|
remark |
String |
Description about the backend, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
enumerations |
String |
Enumerated value. |
|
min_num |
Integer |
Minimum value. This parameter is valid when type is set to NUMBER. |
|
max_num |
Integer |
Maximum value. This parameter is valid when type is set to NUMBER. |
|
min_size |
Integer |
Minimum length. This parameter is valid when type is set to STRING. |
|
max_size |
Integer |
Maximum length. This parameter is valid when type is set to STRING. |
|
regular |
String |
Regular expression validation rule. This parameter is currently not supported. |
|
json_schema |
String |
JSON validation rule. This parameter is currently not supported. |
|
pass_through |
Integer |
Indicates whether to transparently transfer the parameter. 1: yes 2: no Enumeration values:
|
|
id |
String |
Parameter ID. |
|
Parameter |
Type |
Description |
|---|---|---|
|
function_urn |
String |
Function URN. |
|
invocation_type |
String |
Invocation mode.
Enumeration values:
|
|
version |
String |
Function version Ensure that the version does not exceed 64 characters. |
|
timeout |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
id |
String |
ID. |
|
effect_mode |
String |
Effective mode of the backend policy.
Enumeration values:
|
|
name |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
|
backend_params |
Array of BackendParam objects |
Backend parameters. |
|
conditions |
Array of CoditionResp objects |
Policy conditions. |
|
authorizer_id |
String |
Backend custom authorizer ID. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
ID. |
|
effect_mode |
String |
Effective mode of the backend policy.
Enumeration values:
|
|
name |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
|
backend_params |
Array of BackendParam objects |
Backend parameters. |
|
conditions |
Array of CoditionResp objects |
Policy conditions. |
|
authorizer_id |
String |
Backend custom authorizer ID. |
|
result_content |
String |
Separate the time of multiple publication records with vertical bars (|). |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
ID. |
|
effect_mode |
String |
Effective mode of the backend policy.
Enumeration values:
|
|
name |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
|
backend_params |
Array of BackendParam objects |
Backend parameters. |
|
conditions |
Array of CoditionResp objects |
Policy conditions. |
|
authorizer_id |
String |
Backend custom authorizer ID. |
|
url_domain |
String |
Endpoint of the policy backend. An endpoint consists of a domain name or IP address and a port number, with not more than 255 characters. It must be in the format "Domain name:Port number", for example, apig.example.com:7443. If the port number is not specified, the default HTTPS port 443 or the default HTTP port 80 is used. The endpoint can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
|
req_protocol |
String |
Request protocol. The value can be HTTP or HTTPS. Enumeration values:
|
|
req_method |
String |
Request method. Enumeration values:
|
|
req_uri |
String |
Request address, which can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (), percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply with URI specifications. The request address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables. The request address must comply with URI specifications. |
|
timeout |
Integer |
Timeout allowed for API Gateway to request the backend service. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000. Unit: ms. Minimum: 1 |
|
vpc_channel_info |
VpcInfo object |
VPC channel details. This parameter is required if vpc_channel_status is set to 1. |
|
vpc_channel_status |
Integer |
Indicates whether to use a VPC channel.
|
|
Parameter |
Type |
Description |
|---|---|---|
|
origin |
String |
Parameter type.
Enumeration values:
|
|
name |
String |
Parameter name. The parameter name must start with a letter and can only contain letters, digits, hyphens (-), underscores (_), and periods (.). Minimum: 1 Maximum: 32 |
|
remark |
String |
Description, which can contain a maximum of 255 characters. Chinese characters must be in UTF-8 or Unicode format. |
|
location |
String |
Parameter location. The value can be PATH, QUERY, or HEADER. Enumeration values:
|
|
value |
String |
Parameter value, which can contain a maximum of 255 characters. If the origin type is REQUEST, the value of this parameter is the parameter name in req_params. If the origin type is CONSTANT, the value is a constant. If the origin type is SYSTEM, the value is a system parameter name. System parameters include gateway parameters, frontend authentication parameters, and backend authentication parameters. You can set the frontend or backend authentication parameters after enabling custom frontend or backend authentication. The gateway parameters are as follows:
Frontend authentication parameter: prefixed with "$context.authorizer.frontend.". For example, to return "aaa" upon successful custom authentication, set this parameter to "$context.authorizer.frontend.aaa". Backend authentication parameter: prefixed with "$context.authorizer.backend.". For example, to return "aaa" upon successful custom authentication, set this parameter to "$context.authorizer.backend.aaa". |
|
id |
String |
Parameter ID. |
|
req_param_id |
String |
ID of the request parameter to which the backend parameter is mapped. |
|
Parameter |
Type |
Description |
|---|---|---|
|
req_param_name |
String |
Input parameter name. This parameter is required if the policy type is param. |
|
condition_type |
String |
Policy condition.
This parameter is required if the policy type is param. Enumeration values:
|
|
condition_origin |
String |
Policy type.
Enumeration values:
|
|
condition_value |
String |
Condition value. |
|
id |
String |
ID. |
|
req_param_id |
String |
Input parameter ID. |
|
req_param_location |
String |
Input parameter location. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Example Requests
{
"group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
"match_mode" : "NORMAL",
"name" : "Api_http",
"auth_type" : "APP",
"backend_type" : "HTTP",
"backend_api" : {
"vpc_channel_status" : 1,
"vpc_channel_info" : {
"vpc_channel_id" : "56a7d7358e1b42459c9d730d65b14e59",
"vpc_proxy_host" : "www.example.com"
},
"req_protocol" : "HTTPS",
"req_method" : "GET",
"req_uri" : "/test/benchmark",
"timeout" : 5000
},
"cors" : false,
"req_protocol" : "HTTPS",
"req_uri" : "/test/http",
"remark" : "Web backend API",
"type" : 1,
"req_method" : "GET",
"result_normal_sample" : "Example success response",
"result_failure_sample" : "Example failure response",
"backend_params" : [ {
"name" : "X-CONSTANT-HEADER",
"value" : "demo",
"location" : "HEADER",
"origin" : "CONSTANT",
"remark" : "constant_demo"
}, {
"name" : "app-id",
"value" : "$context.appId",
"location" : "HEADER",
"origin" : "SYSTEM",
"remark" : "App ID of the API caller"
} ],
"tags" : [ "webApi" ]
}
Example Responses
Status code: 200
OK
{
"id" : "5f918d104dc84480a75166ba99efff21",
"tags" : [ "webApi" ],
"arrange_necessary" : 2,
"backend_type" : "HTTP",
"auth_type" : "APP",
"auth_opt" : {
"app_code_auth_type" : "DISABLE"
},
"backend_api" : {
"update_time" : "2020-08-02T16:32:47.077028841Z",
"vpc_channel_status" : 1,
"vpc_channel_info" : {
"vpc_channel_id" : "56a7d7358e1b42459c9d730d65b14e59",
"vpc_channel_proxy_host" : "www.example.com"
},
"url_domain" : "56a7d7358e1b42459c9d730d65b14e59",
"req_protocol" : "HTTPS",
"id" : "1ce8fda3586d4371bd83c955df37e102",
"req_method" : "GET",
"register_time" : "2020-07-31T12:42:51Z",
"req_uri" : "/test/benchmark",
"timeout" : 5000,
"status" : 1
},
"cors" : false,
"status" : 1,
"group_name" : "api_group_001",
"group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
"group_version" : "V1",
"match_mode" : "NORMAL",
"name" : "Api_http",
"req_protocol" : "HTTPS",
"req_method" : "GET",
"req_uri" : "/test/http",
"type" : 1,
"version" : "V0.0.1",
"result_normal_sample" : "Example success response",
"result_failure_sample" : "Example failure response",
"register_time" : "2020-07-31T12:42:51Z",
"update_time" : "2020-08-02T16:32:47.046288842Z",
"remark" : "Web backend API",
"backend_params" : [ {
"name" : "X-CONSTANT-HEADER",
"value" : "demo",
"location" : "HEADER",
"origin" : "CONSTANT",
"remark" : "constant_demo",
"id" : "8cb2eba19e7a4423a4e835647a8b8d76"
}, {
"name" : "app-id",
"value" : "$context.appId",
"location" : "HEADER",
"origin" : "SYSTEM",
"remark" : "App ID of the API caller",
"id" : "216ddda836e74d528f364ff589d9dd21"
} ]
}
Status code: 400
Bad Request
{
"error_code" : "APIG.2011",
"error_msg" : "Invalid parameter value,parameterName:name. Please refer to the support documentation"
}
Status code: 401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
}
Status code: 403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
}
Status code: 404
Not Found
{
"error_code" : "APIG.3002",
"error_msg" : "API 5f918d104dc84480a75166ba99efff21 does not exist"
}
Status code: 500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
404 |
Not Found |
|
500 |
Internal Server Error |
Error Codes
See Error Codes.
Last Article: Registering an API
Next Article: Deleting an API
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.