Creating an API
Function
This API is used to create an API. API is an interface that encapsulates a set of service capabilities.
The definition of an API defines how the API is called by users and how ROMA Connect accesses the actual backend service requested by users. APIC supports three backend types: HTTP/HTTPS web, FunctionGraph, and Mock.
URI
POST /v2/{project_id}/apic/instances/{instance_id}/apis
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference. |
instance_id |
Yes |
String |
Instance ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
API name. The value can contain 3 to 255 characters, including letters, digits, hyphens (-), underscores (_), periods (.), slashes (/), parentheses, and colons (:). The value must start with a letter or digit.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Minimum: 3 Maximum: 255 |
type |
Yes |
Integer |
API type.
|
version |
No |
String |
API version. Maximum: 16 |
req_protocol |
Yes |
String |
API request protocol.
Default: HTTPS |
req_method |
Yes |
String |
API request method. |
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.
|
auth_opt |
No |
AuthOpt object |
Security authentication parameter. |
cors |
No |
Boolean |
Whether CORS is supported.
Default: false |
match_mode |
No |
String |
Route matching mode.
|
backend_type |
Yes |
String |
Backend type.
|
remark |
No |
String |
Description of the API, which cannot contain < and >.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Minimum: 0 Maximum: 1000 |
group_id |
Yes |
String |
ID of the API group to which the API belongs. Minimum: 1 Maximum: 65 |
body_remark |
No |
String |
API request body, which can be an example request body, media type, or parameters. Ensure that the response does not exceed 20,480 characters. Maximum: 20480 |
result_normal_sample |
No |
String |
Example response for a successful request.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 20480 |
result_failure_sample |
No |
String |
Example response for a failed request.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 20480 |
authorizer_id |
No |
String |
ID of the frontend custom authorizer. Minimum: 1 Maximum: 65 |
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. This parameter is currently not supported. Minimum: 1 Maximum: 65 |
roma_app_id |
No |
String |
ID of the integration application to which an API belongs. This parameter is mandatory when the API group is a global group or when an API is bound to a user-defined domain name. Minimum: 1 Maximum: 65 |
domain_name |
No |
String |
User-defined domain name bound to the API. If a user-defined domain name is used, the roma_app_id field is mandatory. Maximum: 255 |
tag |
No |
String |
Tag. This field will be deprecated. You can use the tags field instead. Maximum: 255 |
mock_info |
No |
ApiMockCreate object |
Mock backend details. |
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
remark |
No |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
result_content |
No |
String |
Response. |
version |
No |
String |
Version. Ensure that the version does not exceed 64 characters. |
authorizer_id |
No |
String |
Backend custom authorizer ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
function_urn |
Yes |
String |
Function URN. |
remark |
No |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
invocation_type |
Yes |
String |
Invocation mode.
|
version |
No |
String |
Version. Maximum: 64 |
timeout |
Yes |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
authorizer_id |
No |
String |
Backend custom authorizer ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Parameter name. The value can contain letters, digits, hyphens (-), underscores (_), and periods (.) and must start with a letter. Minimum: 1 Maximum: 32 |
type |
Yes |
String |
Parameter type. |
location |
Yes |
String |
Parameter location. |
default_value |
No |
String |
Default value. |
sample_value |
No |
String |
Example value. |
required |
No |
Integer |
Indicates whether the parameter is mandatory. 1: The parameter is mandatory. 2: The parameter is optional. The value of this parameter is 1 if Location is set to PATH, and 2 if Location is set to another value. |
valid_enable |
No |
Integer |
Indicates whether validity check is enabled.
|
remark |
No |
String |
Description.
NOTE:
Characters must be in UTF-8 or Unicode format. Maximum: 255 |
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 transmit the parameter. 1: The parameter is transparently transmitted. 2: The parameter is not transparently transmitted. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
result_content |
No |
String |
Response. |
effect_mode |
Yes |
String |
Effective mode of the backend policy.
|
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 ApiConditionCreate objects |
Policy conditions |
authorizer_id |
No |
String |
Backend custom authorizer ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
function_urn |
Yes |
String |
Function URN. |
invocation_type |
Yes |
String |
Invocation mode.
|
timeout |
Yes |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
version |
No |
String |
Version. Ensure that the version does not exceed 64 characters. |
effect_mode |
Yes |
String |
Effective mode of the backend policy.
|
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 ApiConditionCreate objects |
Policy conditions |
authorizer_id |
No |
String |
Backend custom authorizer ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
authorizer_id |
No |
String |
Backend custom authorizer ID. |
url_domain |
No |
String |
Address of the backend service. The value consists of the host (IP address or domain name) and port number. The total length cannot exceed 255 characters. The format is Host name:Port number (for example, apig.example.com:7443). If the port number is not specified, the default HTTPS port number is 443, and the default HTTP port number is 80. Environment variables are supported. If environment variables are used, each variable name is a string of 3 to 32 characters. The string consists of letters, digits, underscores (_), and hyphens (-), and must start with an English letter. |
req_protocol |
Yes |
String |
Request protocol. |
remark |
No |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
req_method |
Yes |
String |
Request method. |
version |
No |
String |
Web backend version, which can contain a maximum of 16 characters. |
req_uri |
Yes |
String |
Request URI. The value can contain request parameters identified by braces ({}), for example, /getUserInfo/{userId}. Special characters such as * % - _ . are supported. The total length cannot exceed 512 characters and must meet the URI specifications. Environment variables are supported. If environment variables are used, each variable name is a string of 3 to 32 characters. The string consists of letters, digits, hyphens (-), and underscores (_) and must start with an English letter. The value must comply with the URI specifications. |
timeout |
Yes |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
enable_client_ssl |
No |
Boolean |
Whether to enable two-way authentication. |
vpc_channel_info |
No |
VpcInfo 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.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ecs_id |
No |
String |
Cloud server ID. |
ecs_name |
No |
Integer |
Cloud server name. |
cascade_flag |
No |
Boolean |
Indicates whether to use the cascading mode. This parameter is currently not supported. |
vpc_channel_proxy_host |
No |
String |
Proxy host. |
vpc_channel_id |
No |
String |
VPC channel ID. Maximum: 64 |
vpc_channel_port |
No |
String |
VPC channel port. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
url_domain |
No |
String |
Endpoint of the policy backend. The value consists of a domain name (or an IP address) and a port number. The total length cannot exceed 255 characters. The value is in Domain name:Port number format, for example, apig.example.com:7443. If the port number is not specified, the default HTTPS port number is 443 and the default HTTP port number is 80. Environment variables are supported. If environment variables are used, each variable name must contain 3 to 32 characters, including letters, digits, underscores (_), and hyphens (-). The value must start with a letter. |
req_protocol |
Yes |
String |
Request protocol. The value can be HTTP or HTTPS. |
req_method |
Yes |
String |
Request method |
req_uri |
Yes |
String |
Request URI. The value can contain request parameters identified by braces ({}), for example, /getUserInfo/{userId}. Special characters such as * % - _ . are supported. The total length cannot exceed 512 characters and must meet the URI specifications. Environment variables are supported. If environment variables are used, each variable name is a string of 3 to 32 characters. The string consists of letters, digits, hyphens (-), and underscores (_) and must start with an English letter. The value must comply with the URI specifications. |
timeout |
No |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
enable_client_ssl |
No |
Boolean |
Whether to enable two-way authentication. |
effect_mode |
Yes |
String |
Effective mode of the backend policy.
|
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 ApiConditionCreate objects |
Policy conditions |
authorizer_id |
No |
String |
Backend custom authorizer ID. |
vpc_channel_info |
No |
VpcInfo 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.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Parameter name, which must start with a letter and can only contain letters, digits, hyphens (-), underscores (_), and periods (.). Minimum: 1 Maximum: 32 |
location |
Yes |
String |
Parameter location. The value can be PATH, QUERY, or HEADER. |
origin |
Yes |
String |
Parameter type. The value can be REQUEST, CONSTANT, and SYSTEM. |
value |
Yes |
String |
Parameter value, which can contain a maximum of 255 characters. If the parameter type is REQUEST, the value is a parameter name in req_params. If the parameter type is CONSTANT, the value is a constant. If the parameter type is SYSTEM, the value is a gateway parameter name. Maximum: 255 |
remark |
No |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
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. |
condition_origin |
Yes |
String |
Policy type.
|
condition_value |
Yes |
String |
Policy value. |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
name |
String |
API name. The value can contain 3 to 255 characters, including letters, digits, hyphens (-), underscores (_), periods (.), slashes (/), parentheses, and colons (:). The value must start with a letter or digit.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Minimum: 3 Maximum: 255 |
type |
Integer |
API type.
|
version |
String |
API version. Maximum: 16 |
req_protocol |
String |
API request protocol.
Default: HTTPS |
req_method |
String |
API request method. |
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.
|
auth_opt |
AuthOpt object |
Security authentication parameter. |
cors |
Boolean |
Whether CORS is supported.
Default: false |
match_mode |
String |
Route matching mode.
|
backend_type |
String |
Backend type.
|
remark |
String |
Description of the API, which cannot contain < and >.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Minimum: 0 Maximum: 1000 |
group_id |
String |
ID of the API group to which the API belongs. Minimum: 1 Maximum: 65 |
body_remark |
String |
API request body, which can be an example request body, media type, or parameters. Ensure that the response does not exceed 20,480 characters. Maximum: 20480 |
result_normal_sample |
String |
Example response for a successful request.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 20480 |
result_failure_sample |
String |
Example response for a failed request.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 20480 |
authorizer_id |
String |
ID of the frontend custom authorizer. Minimum: 1 Maximum: 65 |
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. This parameter is currently not supported. Minimum: 1 Maximum: 65 |
roma_app_id |
String |
ID of the integration application to which an API belongs. This parameter is mandatory when the API group is a global group or when an API is bound to a user-defined domain name. Minimum: 1 Maximum: 65 |
domain_name |
String |
User-defined domain name bound to the API. If a user-defined domain name is used, the roma_app_id field is mandatory. Maximum: 255 |
tag |
String |
Tag. This field will be deprecated. You can use the tags field instead. Maximum: 255 |
id |
String |
API ID. |
status |
Integer |
API status.
|
arrange_necessary |
Integer |
Indicates whether orchestration is required. |
register_time |
String |
Time when the API was registered. |
update_time |
String |
Time when the API was last modified. |
group_name |
String |
API group name. |
group_version |
String |
Version of the API group to which the API belongs. |
run_env_name |
String |
Name of the environment in which the API was published |
run_env_id |
String |
ID of the environment in which the API was published. |
publish_id |
String |
Publication record ID. You can separate multiple publication records with vertical bars (|). |
roma_app_name |
String |
Name of the integration application to which the API belongs. |
ld_api_id |
String |
ID of the custom backend API when the API backend is a custom backend. |
func_info |
ApiFunc object |
FunctionGraph backend details. |
mock_info |
ApiMock object |
Mock backend details. |
req_params |
Array of ReqParam objects |
Request parameters. |
backend_params |
Array of BackendParam objects |
Backend parameters |
policy_functions |
Array of ApiPolicyFunctionResp objects |
FunctionGraph policy backends |
policy_mocks |
Array of ApiPolicyMockResp objects |
Mock policy backends |
backend_api |
BackendApi object |
Web backend details |
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 |
Parameter |
Type |
Description |
---|---|---|
function_urn |
String |
Function URN. |
remark |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
invocation_type |
String |
Invocation mode.
|
version |
String |
Version. Maximum: 64 |
timeout |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
authorizer_id |
String |
Backend custom authorizer ID. |
id |
String |
ID. |
register_time |
String |
Registration time. |
status |
Integer |
Backend status.
|
update_time |
String |
Update time. |
Parameter |
Type |
Description |
---|---|---|
remark |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
result_content |
String |
Response. |
version |
String |
Version. Ensure that the version does not exceed 64 characters. |
authorizer_id |
String |
Backend custom authorizer ID. |
id |
String |
ID. |
register_time |
String |
Registration time. |
status |
Integer |
Backend status.
|
update_time |
String |
Update time. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Parameter name. The value can contain letters, digits, hyphens (-), underscores (_), and periods (.) and must start with a letter. Minimum: 1 Maximum: 32 |
type |
String |
Parameter type. |
location |
String |
Parameter location. |
default_value |
String |
Default value. |
sample_value |
String |
Example value. |
required |
Integer |
Indicates whether the parameter is mandatory. 1: The parameter is mandatory. 2: The parameter is optional. The value of this parameter is 1 if Location is set to PATH, and 2 if Location is set to another value. |
valid_enable |
Integer |
Indicates whether validity check is enabled.
|
remark |
String |
Description.
NOTE:
Characters must be in UTF-8 or Unicode format. Maximum: 255 |
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 transmit the parameter. 1: The parameter is transparently transmitted. 2: The parameter is not transparently transmitted. |
id |
String |
Parameter ID. |
Parameter |
Type |
Description |
---|---|---|
function_urn |
String |
Function URN. |
invocation_type |
String |
Invocation mode.
|
timeout |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
version |
String |
Version. Ensure that the version does not exceed 64 characters. |
id |
String |
ID. |
name |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
conditions |
Array of ConditionResp objects |
Policy conditions |
backend_params |
Array of BackendParam objects |
Backend parameters |
effect_mode |
String |
Effective mode of the backend policy.
|
authorizer_id |
String |
Backend custom authorizer ID. Minimum: 1 Maximum: 65 |
Parameter |
Type |
Description |
---|---|---|
id |
String |
ID. |
name |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
conditions |
Array of ConditionResp objects |
Policy conditions |
backend_params |
Array of BackendParam objects |
Backend parameters |
effect_mode |
String |
Effective mode of the backend policy.
|
authorizer_id |
String |
Backend custom authorizer ID. Minimum: 1 Maximum: 65 |
result_content |
String |
Response. |
Parameter |
Type |
Description |
---|---|---|
authorizer_id |
String |
Backend custom authorizer ID. |
url_domain |
String |
Address of the backend service. The value consists of the host (IP address or domain name) and port number. The total length cannot exceed 255 characters. The format is Host name:Port number (for example, apig.example.com:7443). If the port number is not specified, the default HTTPS port number is 443, and the default HTTP port number is 80. Environment variables are supported. If environment variables are used, each variable name is a string of 3 to 32 characters. The string consists of letters, digits, underscores (_), and hyphens (-), and must start with an English letter. |
req_protocol |
String |
Request protocol. |
remark |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
req_method |
String |
Request method. |
version |
String |
Web backend version, which can contain a maximum of 16 characters. |
req_uri |
String |
Request URI. The value can contain request parameters identified by braces ({}), for example, /getUserInfo/{userId}. Special characters such as * % - _ . are supported. The total length cannot exceed 512 characters and must meet the URI specifications. Environment variables are supported. If environment variables are used, each variable name is a string of 3 to 32 characters. The string consists of letters, digits, hyphens (-), and underscores (_) and must start with an English letter. The value must comply with the URI specifications. |
timeout |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
enable_client_ssl |
Boolean |
Whether to enable two-way authentication. |
id |
String |
ID. |
status |
Integer |
Backend 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 |
Integer |
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. Maximum: 64 |
vpc_channel_port |
String |
VPC channel port. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
ID. |
name |
String |
Backend name, which must start with a letter and can contain letters, digits, and underscores (_). Minimum: 3 Maximum: 64 |
conditions |
Array of ConditionResp objects |
Policy conditions |
backend_params |
Array of BackendParam objects |
Backend parameters |
effect_mode |
String |
Effective mode of the backend policy.
|
authorizer_id |
String |
Backend custom authorizer ID. Minimum: 1 Maximum: 65 |
url_domain |
String |
Endpoint of the policy backend. The value consists of a domain name (or an IP address) and a port number. The total length cannot exceed 255 characters. The value is in Domain name:Port number format, for example, apig.example.com:7443. If the port number is not specified, the default HTTPS port number is 443 and the default HTTP port number is 80. Environment variables are supported. If environment variables are used, each variable name must contain 3 to 32 characters, including letters, digits, underscores (_), and hyphens (-). The value must start with a letter. |
req_protocol |
String |
Request protocol. The value can be HTTP or HTTPS. |
req_method |
String |
Request method |
req_uri |
String |
Request URI. The value can contain request parameters identified by braces ({}), for example, /getUserInfo/{userId}. Special characters such as * % - _ . are supported. The total length cannot exceed 512 characters and must meet the URI specifications. Environment variables are supported. If environment variables are used, each variable name is a string of 3 to 32 characters. The string consists of letters, digits, hyphens (-), and underscores (_) and must start with an English letter. The value must comply with the URI specifications. |
timeout |
Integer |
Timeout interval allowed for ROMA Connect APIC to request the backend service. The unit is millisecond. The default value will be used if the specified value is outside the allowable range. Minimum: 1 |
enable_client_ssl |
Boolean |
Whether to enable two-way authentication. |
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 |
---|---|---|
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. |
condition_origin |
String |
Policy type.
|
condition_value |
String |
Policy value. |
id |
String |
ID. |
req_param_id |
String |
Input parameter ID. |
req_param_location |
String |
Input parameter location. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Parameter name, which must start with a letter and can only contain letters, digits, hyphens (-), underscores (_), and periods (.). Minimum: 1 Maximum: 32 |
location |
String |
Parameter location. The value can be PATH, QUERY, or HEADER. |
origin |
String |
Parameter type. The value can be REQUEST, CONSTANT, and SYSTEM. |
value |
String |
Parameter value, which can contain a maximum of 255 characters. If the parameter type is REQUEST, the value is a parameter name in req_params. If the parameter type is CONSTANT, the value is a constant. If the parameter type is SYSTEM, the value is a gateway parameter name. Maximum: 255 |
remark |
String |
Description.
NOTE:
Characters must be encoded using UTF-8 or Unicode. Maximum: 255 |
id |
String |
Parameter ID. |
req_param_id |
String |
ID of the request parameter to which the backend parameter is mapped. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Example Requests
-
API for creating a web backend
{ "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "NORMAL", "name" : "Api_http", "auth_type" : "AUTHORIZER", "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c", "backend_type" : "HTTP", "backend_api" : { "url_domain" : "10.10.10.156:12346", "req_protocol" : "HTTP", "req_method" : "GET", "req_uri" : "/test/benchmark", "timeout" : 5000 }, "req_protocol" : "HTTPS", "req_uri" : "/test/http", "remark" : "Web backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "webApi" ], "req_params" : [ { "name" : "query_demo", "location" : "QUERY", "type" : "STRING", "required" : 1 }, { "name" : "header-demo", "location" : "HEADER", "type" : "STRING", "required" : 2 } ], "backend_params" : [ { "name" : "backHeader", "value" : "header-demo", "location" : "HEADER", "origin" : "REQUEST" }, { "name" : "backQuery", "value" : "query_demo", "location" : "QUERY", "origin" : "REQUEST" }, { "name" : "X-CONSTANT-HEADER", "value" : "demo", "location" : "HEADER", "origin" : "CONSTANT", "remark" : "constant_demo" }, { "name" : "app-id", "value" : "$context.appId", "location" : "HEADER", "origin" : "SYSTEM", "remark" : "Application ID of the invoker." } ] }
-
API for creating a FunctinGraph backend
{ "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "backend_type" : "FUNCTION", "func_info" : { "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "invocation_type" : "sync", "timeout" : 5000, "version" : "latest" }, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "FunctionGraph backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "functionApi" ] }
-
API for creating a Mock backend
{ "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "backend_type" : "MOCK", "mock_info" : { "result_content" : "mock success" }, "policy_mocks" : [ { "name" : "mock policy backend", "effect_mode" : "ANY", "result_content" : "mock policy success", "conditions" : [ { "condition_origin" : "source", "condition_value" : "1.0.1.0" } ] } ], "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "Mock backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "mockApi" ] }
Example Responses
Status code: 201
Created
-
Example 1
{ "id" : "5f918d104dc84480a75166ba99efff21", "tags" : [ "webApi" ], "arrange_necessary" : 2, "backend_type" : "HTTP", "auth_type" : "AUTHORIZER", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c", "backend_api" : { "update_time" : "2020-07-31T12:42:51.325312994Z", "vpc_channel_status" : 2, "url_domain" : "10.10.10.156:12346", "req_protocol" : "HTTP", "id" : "1ce8fda3586d4371bd83c955df37e102", "req_method" : "GET", "register_time" : "2020-07-31T12:42:51.325312721Z", "req_uri" : "/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, "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "version" : "V0.0.1", "register_time" : "2020-07-31T12:42:51.314357035Z", "update_time" : "2020-07-31T12:42:51.314357324Z", "remark" : "Web backend API", "req_params" : [ { "name" : "query_demo", "location" : "QUERY", "type" : "STRING", "valid_enable" : 2, "required" : 1, "id" : "57c8bf3c97ef40ee94eace95dff30014", "pass_through" : 1 }, { "name" : "header-demo", "location" : "HEADER", "type" : "STRING", "valid_enable" : 2, "required" : 2, "id" : "8d993be96980415faa6b1fb2ebd647e0", "pass_through" : 1 } ], "backend_params" : [ { "name" : "backHeader", "value" : "header-demo", "location" : "HEADER", "origin" : "REQUEST", "id" : "709f0ea376b44aaf907aaaa37d8cce92", "req_param_id" : "8d993be96980415faa6b1fb2ebd647e0" }, { "name" : "backQuery", "value" : "query_demo", "location" : "QUERY", "origin" : "REQUEST", "id" : "2f152d0fb54445039158d29c2a4f69ee", "req_param_id" : "57c8bf3c97ef40ee94eace95dff30014" }, { "name" : "X-CONSTANT-HEADER", "value" : "demo", "location" : "HEADER", "origin" : "CONSTANT", "remark" : "constant_demo", "id" : "20142102c6aa4f3c97d5fd6ef4010ac2" }, { "name" : "app-id", "value" : "$context.appId", "location" : "HEADER", "origin" : "SYSTEM", "remark" : "Application ID of the invoker.", "id" : "a1349c61016e4d999ca783a50bfeee2b" } ] }
-
Example 2
{ "id" : "abd9c4b2ff974888b0ba79be7e6b2763", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "FUNCTION", "func_info" : { "id" : "c0740524cd4c40e3801a7afe5375f8b0", "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "invocation_type" : "sync", "timeout" : 5000, "version" : "latest", "register_time" : "2020-08-02T15:36:19.897262803Z", "update_time" : "2020-08-02T15:36:19.897262993Z", "status" : 1 }, "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "FunctionGraph backend API", "type" : 1, "version" : "V0.0.1", "status" : 1, "req_method" : "GET", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "functionApi" ], "register_time" : "2020-08-02T15:36:19.892012381Z", "update_time" : "2020-08-02T15:36:19.892012627Z" }
-
Example 3
{ "id" : "3a955b791bd24b1c9cd94c745f8d1aad", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "MOCK", "mock_info" : { "id" : "e74bbc75825c4c38ae84ccab6bdc6175", "result_content" : "mock success", "update_time" : "2020-08-02T15:56:52.301790686Z", "register_time" : "2020-08-02T15:56:52.301790367Z" }, "policy_mocks" : [ { "name" : "mock policy backend", "id" : "1cb05173a4c84b7d996e30145cce3c7d", "effect_mode" : "ANY", "result_content" : "mock policy success", "conditions" : [ { "condition_origin" : "source", "condition_value" : "1.0.1.0", "id" : "8650b3a94e7344df8251658d8aee1f6d" } ] } ], "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "Mock backend API", "type" : 1, "version" : "V0.0.1", "req_method" : "GET", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "mockApi" ], "register_time" : "2020-08-02T15:56:52.286099413Z", "update_time" : "2020-08-02T15:56:52.286099715Z", "status" : 1 }
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.3019", "error_msg" : "The function URN does not exist" }
Status code: 500
Internal Server Error
{ "error_code" : "APIG.9999", "error_msg" : "System error" }
Status Codes
Status Code |
Description |
---|---|
201 |
Created |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot