Updated on 2024-12-10 GMT+08:00

Creating an API

Function

This API is used to create an API. An 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 APIG accesses the actual backend service requested by users. APIG supports four backend types: HTTP/HTTPS, gRPC, FunctionGraph, and Mock.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/apigw/instances/{instance_id}/apis

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain it, see Obtaining a Project ID.

instance_id

Yes

String

Gateway ID, which can be obtained from the gateway information on the APIG console.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It 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 a token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

API name.

It can contain 3 to 255 characters, starting with a letter or digit. Only letters, digits, and these special characters are allowed: -_./:()

type

Yes

Integer

API type.

  • 1: public API
  • 2: private API

version

No

String

API version.

Maximum: 16

req_protocol

Yes

String

API request protocol:

  • HTTP
  • HTTPS
  • BOTH: Both HTTP and HTTPS are supported.
  • GRPCS

Default: HTTPS

req_method

Yes

String

API request method. If the request protocol is set to GRPC, the request method is fixed to POST.

req_uri

Yes

String

Request address, which can contain request parameters enclosed with braces ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), slashes (/), percent signs (%), hyphens (-), underscores (_), and periods (.), are allowed. It can contain a maximum of 512 characters and must comply with URI specifications.

NOTE:

The address must comply with the URI specifications.

auth_type

Yes

String

API authentication mode. Options:

  • NONE
  • APP
  • IAM
  • AUTHORIZER: custom authentication. When auth_type is set to AUTHORIZER, the authorizer_id field is mandatory.

auth_opt

No

AuthOpt object

Security authentication parameter.

cors

No

Boolean

Indicates whether CORS is supported.

  • TRUE: supported
  • FALSE: not supported

Default: false

match_mode

No

String

API matching mode:

  • SWA: Prefix match
  • NORMAL: Exact match

    Default value: NORMAL

backend_type

Yes

String

Backend type. Options:

  • HTTP: web backend
  • FUNCTION: FunctionGraph backend. When backend_type is set to FUNCTION, the func_info field is mandatory.
  • MOCK: mock backend. When backend_type is set to MOCK, the mock_info field is mandatory.
  • GRPC: gRPC backend.

remark

No

String

API description. It cannot exceed 255 characters.

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.

result_normal_sample

No

String

Example response for a successful request. Ensure that the response does not exceed 20,480 characters.

This is unavailable if the request protocol is set to GRPC.

result_failure_sample

No

String

Example response for a failed request. Ensure that the response does not exceed 20,480 characters.

This is unavailable if the request protocol is set to GRPC.

authorizer_id

No

String

ID of the frontend custom authorizer

tags

No

Array of strings

Tag. Use letters, digits, and special characters (-*#%.:_) and start with a letter. By default, 10 tags are supported. To increase the quota, contact technical support to modify the API_TAG_NUM_LIMIT configuration.

Minimum: 1

Maximum: 128

response_id

No

String

Group response ID.

roma_app_id

No

String

Integration application ID.

Currently, this parameter is not supported.

domain_name

No

String

Custom domain name bound to the API.

Currently, this parameter is 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-data

text/plain

is_send_fg_body_base64

No

Boolean

Specifies whether to perform Base64 encoding on the body for interaction with FunctionGraph. The body does not need to be encoded using Base64 only when content_type is set to application/json.

Application scenario:

  • Custom authentication
  • Bound circuit breaker plug-in with FunctionGraph backend downgrade policy
  • APIs with FunctionGraph backend

Default: true

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. This is unavailable if the request protocol is set to GRPC.

backend_params

No

Array of BackendParamBase objects

Backend parameters. This is unavailable if the request protocol is set to GRPC.

policy_mocks

No

Array of ApiPolicyMockCreate objects

Mock backend policies.

policy_functions

No

Array of ApiPolicyFunctionCreate objects

FunctionGraph backend policies.

backend_api

No

BackendApiCreate object

Web backend details.

policy_https

No

Array of ApiPolicyHttpCreate objects

Web backend policies.

Table 4 AuthOpt

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.

  • DISABLE: AppCode authentication is disabled.
  • HEADER: AppCode authentication is enabled and the AppCode is located in the header.

Default: DISABLE

Table 5 ApiMockCreate

Parameter

Mandatory

Type

Description

remark

No

String

Description. It cannot exceed 255 characters.

result_content

No

String

Response.

version

No

String

Function version. It cannot exceed 64 characters.

authorizer_id

No

String

Backend custom authorizer ID.

Table 6 ApiFuncCreate

Parameter

Mandatory

Type

Description

function_urn

Yes

String

Function URN.

remark

No

String

Description. It cannot exceed 255 characters.

invocation_type

Yes

String

Invocation mode.

  • async: asynchronous
  • sync: synchronous

network_type

Yes

String

Function network architecture.

  • V1: non-VPC
  • V2: VPC

version

No

String

Function version.

If both a function alias URN and version are passed, only the alias URN will be used.

Maximum: 64

alias_urn

No

String

Function alias URN.

If both a function alias URN and version are passed, the alias URN will be used and the version will be ignored.

timeout

Yes

Integer

Timeout allowed for APIG to request the backend service. If the function network architecture is set to V1, the maximum timeout is 60,000. If the network architecture is set to V2, the maximum timeout is 600,000 and can be modified by using the gateway parameter backend_timeout.

Unit: ms.

Minimum: 1

authorizer_id

No

String

Backend custom authorizer ID.

req_protocol

No

String

Backend request protocol of a function. The value can be HTTPS (default) or GRPCS (available when the frontend request protocol is GRPCS).

Default: HTTPS

Table 7 ReqParamBase

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.

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 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.

valid_enable

No

Integer

Indicates whether validity check is enabled.

  • 1: enabled
  • 2: disabled

Default: 2

remark

No

String

Description. It cannot exceed 255 characters.

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.

Currently, this parameter is not supported.

json_schema

No

String

JSON validation rule.

Currently, this parameter is not supported.

pass_through

No

Integer

Indicates whether to transparently transfer the parameter.

1: yes

2: no

orchestrations

No

Array of strings

Request parameter orchestration rules are prioritized in the same sequence as the list.

The none_value rule in a rule list has the highest priority. A maximum of one none_value rule can be bound.

The default rule in a rule list has the lowest priority. A maximum of one default rule can be bound.

The preprocessing orchestration rule cannot be used as the last orchestration rule except the default rule.

Only one parameter of each API can be bound with unique orchestration rules. The number of orchestration rules that can be bound is limited by quota. For details, see "Notes and Constraints" in APIG Service Overview.

Table 8 ApiPolicyMockCreate

Parameter

Mandatory

Type

Description

result_content

No

String

Response.

effect_mode

Yes

String

Effective mode of the backend policy.

  • ALL: All conditions are met.
  • ANY: Any condition is met.

name

Yes

String

Backend name. It 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. This is unavailable for the GRPC backend.

conditions

Yes

Array of ApiConditionBase objects

Policy conditions.

authorizer_id

No

String

Backend custom authorizer ID.

Table 9 ApiPolicyFunctionCreate

Parameter

Mandatory

Type

Description

function_urn

Yes

String

Function URN.

invocation_type

Yes

String

Invocation mode.

  • async: asynchronous
  • sync: synchronous

network_type

Yes

String

Function network architecture.

  • V1: non-VPC
  • V2: VPC

version

No

String

Function version.

If both a function alias URN and version are passed, the alias URN will be used and the version will be ignored.

Maximum: 64

alias_urn

No

String

Function alias URN.

If both a function alias URN and version are passed, the alias URN will be used and the version will be ignored.

timeout

No

Integer

Timeout allowed for APIG to request the backend service. If the function network architecture is set to V1, the maximum timeout is 60,000. If the network architecture is set to V2, the maximum timeout is 600,000 and can be modified by using the gateway parameter backend_timeout.

Unit: ms.

Minimum: 1

req_protocol

No

String

Backend request protocol of a function. The value can be HTTPS (default) or GRPCS (available when the frontend request protocol is GRPCS).

Default: HTTPS

effect_mode

Yes

String

Effective mode of the backend policy.

  • ALL: All conditions are met.
  • ANY: Any condition is met.

name

Yes

String

Backend name. It 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. This is unavailable for the GRPC backend.

conditions

Yes

Array of ApiConditionBase objects

Policy conditions.

authorizer_id

No

String

Backend custom authorizer ID.

Table 10 BackendApiCreate

Parameter

Mandatory

Type

Description

authorizer_id

No

String

Backend custom authorizer ID.

url_domain

No

String

Backend service address. Required when no VPC channel is used.

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.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

req_protocol

Yes

String

Request protocol. You can select GRPC or GRPCS for the GRPC backend.

remark

No

String

Description. It cannot exceed 255 characters.

req_method

Yes

String

Request method. For the GRPC backend, the request method is fixed to POST.

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 braces ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), slashes (/), percent signs (%), hyphens (-), underscores (_), and periods (.), are allowed. It can contain a maximum of 512 characters and must comply with URI specifications.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

NOTE:

The address must comply with the URI specifications.

For the GRPC backend, the request address is fixed to /.

timeout

Yes

Integer

Timeout allowed for APIG 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.

retry_count

No

String

Number of retry attempts to request the backend service. The default value is –1. The value ranges from –1 to 10.

–1 indicates that idempotent APIs will retry once and non-idempotent APIs will not retry. POST and PATCH are non-idempotent. GET, HEAD, PUT, OPTIONS, and DELETE are idempotent.

Default: -1

enable_sm_channel

No

Boolean

Indicates whether to enable SM cryptographic algorithms.

This feature is only available if the gateway supports the SM cryptographic algorithms.

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.

  • 1: A VPC channel is used.
  • 2: No VPC channel is used.
Table 11 ApiPolicyHttpCreate

Parameter

Mandatory

Type

Description

url_domain

No

String

Endpoint of the policy backend. Required when no VPC channel is used.

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.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

req_protocol

Yes

String

Request protocol. Options include HTTP, HTTPS, GRPC, or GRPCS. You can select GRPC or GRPCS for the GRPC backend.

req_method

Yes

String

Request method. Options include GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, and ANY. This is fixed to POST for the GRPC backend.

req_uri

Yes

String

Request address, which can contain request parameters enclosed with braces ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), slashes (/), percent signs (%), hyphens (-), underscores (_), and periods (.), are allowed. It can contain a maximum of 512 characters and must comply with URI specifications.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

NOTE:

The address must comply with the URI specifications.

For the GRPC backend, the request address is fixed to /.

timeout

No

Integer

Timeout allowed for APIG 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

retry_count

No

String

Number of retry attempts to request the backend service. The default value is –1. The value ranges from –1 to 10.

–1 indicates that idempotent APIs will retry once and non-idempotent APIs will not retry. POST and PATCH are non-idempotent. GET, HEAD, PUT, OPTIONS, and DELETE are idempotent.

Default: -1

enable_sm_channel

No

Boolean

Indicates whether to enable SM cryptographic algorithms.

This feature is only available if the gateway supports the SM cryptographic algorithms.

effect_mode

Yes

String

Effective mode of the backend policy.

  • ALL: All conditions are met.
  • ANY: Any condition is met.

name

Yes

String

Backend name. It 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. This is unavailable for the GRPC backend.

conditions

Yes

Array of ApiConditionBase objects

Policy conditions.

authorizer_id

No

String

Backend custom authorizer 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.

  • 1: A VPC channel is used.
  • 2: No VPC channel is used.
Table 12 BackendParamBase

Parameter

Mandatory

Type

Description

origin

Yes

String

Parameter type.

  • REQUEST: backend parameter
  • CONSTANT: constant parameter
  • SYSTEM: system parameter

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.

location

Yes

String

Parameter location. The value can be PATH, QUERY, or HEADER.

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:

  • $context.sourceIp: source IP address of the API caller.
  • $context.stage: deployment environment in which the API is called.
  • $context.apiId: API ID.
  • $context.appId: ID of the app used by the API caller.
  • $context.requestId: request ID generated when the API is called.
  • $context.serverAddr: address of the gateway server.
  • $context.serverName: name of the gateway server.
  • $context.handleTime: time when the API request is processed.
  • $context.providerAppId: ID of the app used by the API owner. This parameter is currently not supported.

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".

Table 13 ApiConditionBase

Parameter

Mandatory

Type

Description

req_param_name

No

String

Input parameter name. This parameter is required if the policy type is param.

sys_param_name

No

String

Name of a built-in gateway parameter. This parameter is required if the policy type is system. The following parameters are supported:

  • req_path: request path. For example, /a/b.
  • req_method: request method. For example, GET.
  • reqPath: request path, which is discarded. For example, /a/b.
  • reqMethod: request method, which is discarded. For example, GET.

cookie_param_name

No

String

COOKIE parameter name. This parameter is required if the policy type is cookie.

Minimum: 0

Maximum: 255

frontend_authorizer_param_name

No

String

System parameter: frontend authentication parameter name. This parameter is mandatory when the policy type is frontend_authorizer. The frontend authentication parameter name is prefixed with $context.authorizer.frontend. For example, if the frontend authentication parameter name is user_name, the name with the prefix will be $context.authorizer.frontend.user_name.

condition_type

No

String

Policy condition.

  • exact: Exact match
  • enum: Enumeration
  • pattern: Regular expression

This parameter is required when the policy type is param, system, cookie, or frontend_authorizer.

condition_origin

Yes

String

Policy type

  • param: parameter
  • source: source IP address
  • system: system parameter - gateway built-in parameter
  • cookie: COOKIE parameter
  • frontend_authorizer: system parameter - frontend authentication parameter

condition_value

Yes

String

Policy value.

Maximum: 1024

mapped_param_name

No

String

Name of a parameter generated after orchestration. This parameter is mandatory when condition_origin is set to orchestration. The generated parameter name must exist in the orchestration rule bound to the API.

mapped_param_location

No

String

Location of a parameter generated after orchestration. This parameter is mandatory when condition_origin is set to orchestration. This location must exist in the orchestration rule bound to the API.

Table 14 ApiBackendVpcReq

Parameter

Mandatory

Type

Description

vpc_channel_proxy_host

No

String

Proxy host.

vpc_channel_id

Yes

String

VPC channel ID.

Response Parameters

Status code: 201

Table 15 Response body parameters

Parameter

Type

Description

name

String

API name.

It can contain 3 to 255 characters, starting with a letter or digit. Only letters, digits, and these special characters are allowed: -_./:()

type

Integer

API type.

  • 1: public API
  • 2: private API

version

String

API version.

Maximum: 16

req_protocol

String

API request protocol:

  • HTTP
  • HTTPS
  • BOTH: Both HTTP and HTTPS are supported.
  • GRPCS

Default: HTTPS

req_method

String

API request method. If the request protocol is set to GRPC, the request method is fixed to POST.

req_uri

String

Request address, which can contain request parameters enclosed with braces ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), slashes (/), percent signs (%), hyphens (-), underscores (_), and periods (.), are allowed. It can contain a maximum of 512 characters and must comply with URI specifications.

NOTE:

The address must comply with the URI specifications.

auth_type

String

API authentication mode. Options:

  • NONE
  • APP
  • IAM
  • AUTHORIZER: custom authentication. When auth_type is set to AUTHORIZER, the authorizer_id field is mandatory.

auth_opt

AuthOpt object

Security authentication parameter.

cors

Boolean

Indicates whether CORS is supported.

  • TRUE: supported
  • FALSE: not supported

Default: false

match_mode

String

API matching mode:

  • SWA: Prefix match
  • NORMAL: Exact match

    Default value: NORMAL

backend_type

String

Backend type. Options:

  • HTTP: web backend
  • FUNCTION: FunctionGraph backend. When backend_type is set to FUNCTION, the func_info field is mandatory.
  • MOCK: mock backend. When backend_type is set to MOCK, the mock_info field is mandatory.
  • GRPC: gRPC backend.

remark

String

API description. It cannot exceed 255 characters.

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.

result_normal_sample

String

Example response for a successful request. Ensure that the response does not exceed 20,480 characters.

This is unavailable if the request protocol is set to GRPC.

result_failure_sample

String

Example response for a failed request. Ensure that the response does not exceed 20,480 characters.

This is unavailable if the request protocol is set to GRPC.

authorizer_id

String

ID of the frontend custom authorizer

tags

Array of strings

Tag. Use letters, digits, and special characters (-*#%.:_) and start with a letter. By default, 10 tags are supported. To increase the quota, contact technical support to modify the API_TAG_NUM_LIMIT configuration.

Minimum: 1

Maximum: 128

response_id

String

Group response ID.

roma_app_id

String

Integration application ID.

Currently, this parameter is not supported.

domain_name

String

Custom domain name bound to the API.

Currently, this parameter is 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-data

text/plain

is_send_fg_body_base64

Boolean

Specifies whether to perform Base64 encoding on the body for interaction with FunctionGraph. The body does not need to be encoded using Base64 only when content_type is set to application/json.

Application scenario:

  • Custom authentication
  • Bound circuit breaker plug-in with FunctionGraph backend downgrade policy
  • APIs with FunctionGraph backend

Default: true

id

String

API ID.

status

Integer

App status.

  • 1: valid

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

Publication time.

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

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 backend policies.

policy_mocks

Array of ApiPolicyMockResp objects

Mock backend policies.

policy_https

Array of ApiPolicyHttpResp objects

Web backend policies.

Table 16 AuthOpt

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.

  • DISABLE: AppCode authentication is disabled.
  • HEADER: AppCode authentication is enabled and the AppCode is located in the header.

Default: DISABLE

Table 17 BackendApi

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.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

req_protocol

String

Request protocol. You can select GRPC or GRPCS for the GRPC backend.

remark

String

Description. It cannot exceed 255 characters.

req_method

String

Request method. For the GRPC backend, the request method is fixed to POST.

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 braces ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), slashes (/), percent signs (%), hyphens (-), underscores (_), and periods (.), are allowed. It can contain a maximum of 512 characters and must comply with URI specifications.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

NOTE:

The address must comply with the URI specifications.

For the GRPC backend, the request address is fixed to /.

timeout

Integer

Timeout allowed for APIG 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.

retry_count

String

Number of retry attempts to request the backend service. The default value is –1. The value ranges from –1 to 10.

–1 indicates that idempotent APIs will retry once and non-idempotent APIs will not retry. POST and PATCH are non-idempotent. GET, HEAD, PUT, OPTIONS, and DELETE are idempotent.

Default: -1

enable_sm_channel

Boolean

Indicates whether to enable SM cryptographic algorithms.

This feature is only available if the gateway supports the SM cryptographic algorithms.

id

String

ID.

status

Integer

Backend service status.

  • 1: valid

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.

  • 1: A VPC channel is used.
  • 2: No VPC channel is used.
Table 18 ApiGroupCommonInfo

Parameter

Type

Description

id

String

ID.

name

String

API group name.

status

Integer

Status.

  • 1: valid

sl_domain

String

Subdomain name that APIG automatically allocates to the API group.

register_time

String

Creation time.

update_time

String

Last modification time.

on_sell_status

Integer

Indicates whether the API group has been listed on KooGallery.

  • 1: listed
  • 2: not listed
  • 3: under review

Not supported currently.

url_domains

Array of UrlDomain objects

Independent domain names bound to the API group.

sl_domain_access_enabled

Boolean

Whether the debugging domain name is accessible. Options: true and false.

Default: true

Table 19 UrlDomain

Parameter

Type

Description

id

String

Domain ID.

domain

String

Domain name.

cname_status

Integer

CNAME resolution status of the domain name.

  • 1: not resolved
  • 2: resolving
  • 3: resolved
  • 4: resolution failed

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

verified_client_certificate_enabled

Boolean

Whether to enable client certificate verification. This parameter is available only when a certificate is bound. It is enabled by default if trusted_root_ca exists, and disabled if trusted_root_ca does not exist.

Default: false

is_has_trusted_root_ca

Boolean

Whether a trusted root certificate (CA) exists. The value is true if trusted_root_ca exists in the bound certificate.

Default: false

ingress_http_port

Integer

Inbound HTTP port bound to the domain name. -1 indicates that no port is available and the protocol is not supported. In this case, you can use the default port 80. Other valid ports must be included in the HTTP inbound ports of the gateway. The value ranges from 1024 to 49151.

When creating a domain name, if this parameter is not set, the default port 80 is used. If this parameter is set, https_port must be set. If both http_port and https_port need to use the default port, leave both parameters blank.

If this parameter is not specified when you modify the domain name, the port number remains unchanged.

Minimum: -1

Maximum: 49151

ingress_https_port

Integer

Inbound HTTPS port bound to the domain name. -1 indicates that no port is available and the protocol is not supported. In this case, you can use the default port 443. Other valid ports must be included in the HTTPS inbound ports of the gateway. The value ranges from 1024 to 49151.

When creating a domain name, if this parameter is not set, the default port 443 is used. If this parameter is set, http_port must be set. If both http_port and https_port need to use the default port, leave both parameters blank.

If this parameter is not specified when you modify the domain name, the port number remains unchanged.

Minimum: -1

Maximum: 49151

ssl_infos

Array of SslInfo objects

SSL certificate list.

Table 20 SslInfo

Parameter

Type

Description

ssl_id

String

SSL certificate ID.

ssl_name

String

SSL certificate name.

algorithm_type

String

Certificate algorithm type:

  • RSA
  • ECC
  • SM2

type

String

Certificate scope:

  • instance
  • global

Default: global

Table 21 ApiFunc

Parameter

Type

Description

function_urn

String

Function URN.

remark

String

Description. It cannot exceed 255 characters.

invocation_type

String

Invocation mode.

  • async: asynchronous
  • sync: synchronous

network_type

String

Function network architecture.

  • V1: non-VPC
  • V2: VPC

version

String

Function version.

If both a function alias URN and version are passed, only the alias URN will be used.

Maximum: 64

alias_urn

String

Function alias URN.

If both a function alias URN and version are passed, the alias URN will be used and the version will be ignored.

timeout

Integer

Timeout allowed for APIG to request the backend service. If the function network architecture is set to V1, the maximum timeout is 60,000. If the network architecture is set to V2, the maximum timeout is 600,000 and can be modified by using the gateway parameter backend_timeout.

Unit: ms.

Minimum: 1

authorizer_id

String

Backend custom authorizer ID.

req_protocol

String

Backend request protocol of a function. The value can be HTTPS (default) or GRPCS (available when the frontend request protocol is GRPCS).

Default: HTTPS

id

String

ID.

register_time

String

Registration time.

status

Integer

Backend service status.

  • 1: valid

update_time

String

Update time.

Table 22 ApiMock

Parameter

Type

Description

remark

String

Description. It cannot exceed 255 characters.

result_content

String

Response.

version

String

Function version. It cannot exceed 64 characters.

authorizer_id

String

Backend custom authorizer ID.

id

String

ID.

register_time

String

Registration time.

status

Integer

Backend service status.

  • 1: valid

update_time

String

Update time.

Table 23 ReqParam

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.

location

String

Parameter location.

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.

valid_enable

Integer

Indicates whether validity check is enabled.

  • 1: enabled
  • 2: disabled

Default: 2

remark

String

Description. It cannot exceed 255 characters.

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.

Currently, this parameter is not supported.

json_schema

String

JSON validation rule.

Currently, this parameter is not supported.

pass_through

Integer

Indicates whether to transparently transfer the parameter.

1: yes

2: no

orchestrations

Array of strings

Request parameter orchestration rules are prioritized in the same sequence as the list.

The none_value rule in a rule list has the highest priority. A maximum of one none_value rule can be bound.

The default rule in a rule list has the lowest priority. A maximum of one default rule can be bound.

The preprocessing orchestration rule cannot be used as the last orchestration rule except the default rule.

Only one parameter of each API can be bound with unique orchestration rules. The number of orchestration rules that can be bound is limited by quota. For details, see "Notes and Constraints" in APIG Service Overview.

id

String

Parameter ID.

Table 24 ApiPolicyFunctionResp

Parameter

Type

Description

function_urn

String

Function URN.

invocation_type

String

Invocation mode.

  • async: asynchronous
  • sync: synchronous

network_type

String

Function network architecture.

  • V1: non-VPC
  • V2: VPC

version

String

Function version.

If both a function alias URN and version are passed, the alias URN will be used and the version will be ignored.

Maximum: 64

alias_urn

String

Function alias URN.

If both a function alias URN and version are passed, the alias URN will be used and the version will be ignored.

timeout

Integer

Timeout allowed for APIG to request the backend service. If the function network architecture is set to V1, the maximum timeout is 60,000. If the network architecture is set to V2, the maximum timeout is 600,000 and can be modified by using the gateway parameter backend_timeout.

Unit: ms.

Minimum: 1

req_protocol

String

Backend request protocol of a function. The value can be HTTPS (default) or GRPCS (available when the frontend request protocol is GRPCS).

Default: HTTPS

id

String

ID.

effect_mode

String

Effective mode of the backend policy.

  • ALL: All conditions are met.
  • ANY: Any condition is met.

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.

Table 25 ApiPolicyMockResp

Parameter

Type

Description

id

String

ID.

effect_mode

String

Effective mode of the backend policy.

  • ALL: All conditions are met.
  • ANY: Any condition is met.

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

Response.

Table 26 ApiPolicyHttpResp

Parameter

Type

Description

id

String

ID.

effect_mode

String

Effective mode of the backend policy.

  • ALL: All conditions are met.
  • ANY: Any condition is met.

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.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

req_protocol

String

Request protocol. Options include HTTP, HTTPS, GRPC, or GRPCS. You can select GRPC or GRPCS for the GRPC backend.

req_method

String

Request method. Options include GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, and ANY. This is fixed to POST for the GRPC backend.

req_uri

String

Request address, which can contain request parameters enclosed with braces ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), slashes (/), percent signs (%), hyphens (-), underscores (_), and periods (.), are allowed. It can contain a maximum of 512 characters and must comply with URI specifications.

Environment variables are supported. Each must start with a letter and can consist of 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

NOTE:

The address must comply with the URI specifications.

For the GRPC backend, the request address is fixed to /.

timeout

Integer

Timeout allowed for APIG 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

retry_count

String

Number of retry attempts to request the backend service. The default value is –1. The value ranges from –1 to 10.

–1 indicates that idempotent APIs will retry once and non-idempotent APIs will not retry. POST and PATCH are non-idempotent. GET, HEAD, PUT, OPTIONS, and DELETE are idempotent.

Default: -1

enable_sm_channel

Boolean

Indicates whether to enable SM cryptographic algorithms.

This feature is only available if the gateway supports the SM cryptographic algorithms.

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.

  • 1: A VPC channel is used.
  • 2: No VPC channel is used.
Table 27 BackendParam

Parameter

Type

Description

origin

String

Parameter type.

  • REQUEST: backend parameter
  • CONSTANT: constant parameter
  • SYSTEM: system parameter

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.

location

String

Parameter location. The value can be PATH, QUERY, or HEADER.

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:

  • $context.sourceIp: source IP address of the API caller.
  • $context.stage: deployment environment in which the API is called.
  • $context.apiId: API ID.
  • $context.appId: ID of the app used by the API caller.
  • $context.requestId: request ID generated when the API is called.
  • $context.serverAddr: address of the gateway server.
  • $context.serverName: name of the gateway server.
  • $context.handleTime: time when the API request is processed.
  • $context.providerAppId: ID of the app used by the API owner. This parameter is currently not supported.

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

Request parameter ID.

Table 28 CoditionResp

Parameter

Type

Description

req_param_name

String

Input parameter name. This parameter is required if the policy type is param.

sys_param_name

String

Name of a built-in gateway parameter. This parameter is required if the policy type is system. The following parameters are supported:

  • req_path: request path. For example, /a/b.
  • req_method: request method. For example, GET.
  • reqPath: request path, which is discarded. For example, /a/b.
  • reqMethod: request method, which is discarded. For example, GET.

cookie_param_name

String

COOKIE parameter name. This parameter is required if the policy type is cookie.

Minimum: 0

Maximum: 255

frontend_authorizer_param_name

String

System parameter: frontend authentication parameter name. This parameter is mandatory when the policy type is frontend_authorizer. The frontend authentication parameter name is prefixed with $context.authorizer.frontend. For example, if the frontend authentication parameter name is user_name, the name with the prefix will be $context.authorizer.frontend.user_name.

condition_type

String

Policy condition.

  • exact: Exact match
  • enum: Enumeration
  • pattern: Regular expression

This parameter is required when the policy type is param, system, cookie, or frontend_authorizer.

condition_origin

String

Policy type

  • param: parameter
  • source: source IP address
  • system: system parameter - gateway built-in parameter
  • cookie: COOKIE parameter
  • frontend_authorizer: system parameter - frontend authentication parameter

condition_value

String

Policy value.

Maximum: 1024

mapped_param_name

String

Name of a parameter generated after orchestration. This parameter is mandatory when condition_origin is set to orchestration. The generated parameter name must exist in the orchestration rule bound to the API.

mapped_param_location

String

Location of a parameter generated after orchestration. This parameter is mandatory when condition_origin is set to orchestration. This location must exist in the orchestration rule bound to the API.

id

String

ID.

req_param_id

String

Input parameter ID.

req_param_location

String

Input parameter location.

Table 29 VpcInfo

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.

Currently, this parameter is not supported.

vpc_channel_proxy_host

String

Proxy host.

vpc_channel_id

String

VPC channel ID.

vpc_channel_port

Integer

VPC channel port.

Status code: 400

Table 30 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 31 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 32 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 33 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 34 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

  • Creating a web backend API
    {
      "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
      "match_mode" : "NORMAL",
      "name" : "Api_http",
      "auth_type" : "AUTHORIZER",
      "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c",
      "backend_type" : "HTTP",
      "backend_api" : {
        "url_domain" : "192.168.189.156:12346",
        "req_protocol" : "HTTP",
        "req_method" : "GET",
        "req_uri" : "/test/benchmark",
        "timeout" : 5000,
        "retry_count" : "-1"
      },
      "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",
      "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" : "App ID of the API caller"
      } ]
    }
  • Creating a gRPC backend API
    {
      "group_id" : "12345abc9215b40bd84f4c469d56daebe",
      "match_mode" : "NORMAL",
      "name" : "Api_grpc",
      "auth_type" : "APP",
      "backend_type" : "GRPC",
      "backend_api" : {
        "req_protocol" : "GRPCS",
        "req_method" : "POST",
        "req_uri" : "/",
        "timeout" : 5000,
        "retry_count" : "-1",
        "enable_client_ssl" : false,
        "vpc_channel_status" : 1,
        "vpc_channel_info" : {
          "vpc_channel_id" : "abcd1234512345678aab9a2614a197ef4"
        }
      },
      "req_protocol" : "GRPCS",
      "req_uri" : "/test/grpc",
      "remark" : "GRPC backend API",
      "type" : 1,
      "req_method" : "POST",
      "tags" : [ "grpcApi" ],
      "cors" : false,
      "auth_opt" : {
        "app_code_auth_type" : "DISABLE"
      }
    }
  • Creating a FunctionGraph backend API
    {
      "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
      "match_mode" : "NORMAL",
      "name" : "Api_function",
      "auth_type" : "APP",
      "backend_type" : "FUNCTION",
      "func_info" : {
        "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9",
        "function_urn" : "'urn:fss:xx-xxx-7:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'",
        "invocation_type" : "sync",
        "network_type" : "V1",
        "timeout" : 5000,
        "version" : "latest",
        "alias_urn" : "urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749:!a1"
      },
      "req_protocol" : "HTTPS",
      "req_uri" : "/test/function",
      "remark" : "FunctionGraph backend API",
      "type" : 1,
      "req_method" : "GET",
      "result_normal_sample" : "Example success response",
      "result_failure_sample" : "Example failure response",
      "tags" : [ "functionApi" ]
    }
  • Creating a Mock backend API
    {
      "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" : "Example success response",
      "result_failure_sample" : "Example failure response",
      "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" : "xxx.xxx.xxx.xxx:12346",
        "req_protocol" : "HTTP",
        "id" : "1ce8fda3586d4371bd83c955df37e102",
        "req_method" : "GET",
        "register_time" : "2020-07-31T12:42:51.325312721Z",
        "req_uri" : "/benchmark",
        "timeout" : 5000,
        "status" : 1,
        "retry_count" : "-1"
      },
      "cors" : false,
      "status" : 1,
      "group_name" : "api_group_001",
      "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
      "group_version" : "V1",
      "response_id" : "981e6c8f847f47199a9faf4409b751a5",
      "match_mode" : "NORMAL",
      "name" : "Api_http",
      "req_protocol" : "HTTPS",
      "req_method" : "GET",
      "req_uri" : "/test/http",
      "type" : 1,
      "result_normal_sample" : "Example success response",
      "result_failure_sample" : "Example failure response",
      "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" : "App ID of the API caller",
        "id" : "a1349c61016e4d999ca783a50bfeee2b"
      } ]
    }
  • Example 2
    {
      "id" : "8789c9367rd1439rf869c23cc0d1ef22",
      "tags" : [ "grpcApi" ],
      "arrange_necessary" : 2,
      "backend_type" : "GRPC",
      "auth_type" : "APP",
      "auth_opt" : {
        "app_code_auth_type" : "DISABLE"
      },
      "backend_api" : {
        "update_time" : "2023-08-29T09:05:17.652404554Z",
        "vpc_channel_status" : 1,
        "vpc_channel_info" : {
          "cascade_flag" : false,
          "vpc_channel_id" : "abcd1234512345678aab9a2614a197ef4",
          "vpc_channel_port" : 0
        },
        "url_domain" : "abcd1234512345678aab9a2614a197ef4",
        "req_protocol" : "GRPCS",
        "id" : "c0123456789d421cb83a396955bd48d0",
        "req_method" : "POST",
        "register_time" : "2023-08-29T09:05:17.652404454Z",
        "req_uri" : "/",
        "timeout" : 5000,
        "enable_client_ssl" : false,
        "retry_count" : "-1",
        "status" : 1
      },
      "cors" : false,
      "status" : 1,
      "group_name" : "api_group_001",
      "group_id" : "12345abc9215b40bd84f4c469d56daebe",
      "group_version" : "V1",
      "response_id" : "ef21ec8c7df94d72a44f9rf1461c5f62",
      "match_mode" : "NORMAL",
      "name" : "Api_grpc",
      "req_protocol" : "GRPCS",
      "req_method" : "POST",
      "req_uri" : "/test/grpc",
      "type" : 1,
      "version" : "V0.0.1",
      "register_time" : "2023-08-29T09:05:17.647533939Z",
      "update_time" : "2023-08-29T09:05:17.647534036Z",
      "remark" : "GRPC backend API",
      "api_group_info" : {
        "id" : "12345abc9215b40bd84f4c469d56daebe",
        "name" : "api_group_001",
        "status" : 1,
        "sl_domain" : "12345abc9215b40bd84f4c469d56daebe.apic.region-1.example.com",
        "register_time" : "2023-08-29T08:38:21Z",
        "update_time" : "2023-08-29T08:38:21Z",
        "on_sell_status" : 2,
        "sl_domain_access_enabled" : true
      }
    }
  • Example 3
    {
      "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:xx-xxx-7:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'",
        "invocation_type" : "sync",
        "network_type" : "V1",
        "timeout" : 5000,
        "version" : "latest",
        "alias_urn" : "urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc00000:!a1",
        "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" : "Example success response",
      "result_failure_sample" : "Example failure response",
      "tags" : [ "functionApi" ],
      "register_time" : "2020-08-02T15:36:19.892012381Z",
      "update_time" : "2020-08-02T15:36:19.892012627Z"
    }
  • Example 4
    {
      "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" : "Example success response",
      "result_failure_sample" : "Example failure response",
      "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.