Updated on 2023-04-06 GMT+08:00

Querying API Version Details

Function

This API is used to query the details of a specified API version.

URI

GET /v2/{project_id}/apigw/instances/{instance_id}/apis/versions/{version_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see "Appendix" > "Obtaining a Project ID" in this document.

instance_id

Yes

String

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

version_id

Yes

String

API version.

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.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

name

String

API name.

It can contain 3 to 64 characters, starting with a letter. Only letters, digits, and underscores (_) are allowed.

type

Integer

API type.

  • 1: public API

  • 2: private API

Enumeration values:

  • 1

  • 2

version

String

API version.

Maximum: 16

req_protocol

String

Request protocol.

  • HTTP

  • HTTPS

  • BOTH: The API can be accessed through both HTTP and HTTPS.

Default: HTTPS

Enumeration values:

  • HTTP

  • HTTPS

  • BOTH

req_method

String

Request method.

Enumeration values:

  • GET

  • POST

  • PUT

  • DELETE

  • HEAD

  • PATCH

  • OPTIONS

  • ANY

req_uri

String

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

auth_type

String

API authentication mode.

  • NONE

  • APP

  • IAM

  • AUTHORIZER

Enumeration values:

  • NONE

  • APP

  • IAM

  • AUTHORIZER

auth_opt

AuthOpt object

Security authentication parameter.

cors

Boolean

Indicates whether CORS is supported.

  • TRUE: supported

  • FALSE: not supported

Default: false

Enumeration values:

  • true

  • false

match_mode

String

Route matching mode.

  • SWA: prefix match

  • NORMAL: exact match.

The default value is NORMAL.

Enumeration values:

  • SWA

  • NORMAL

backend_type

String

Backend type.

  • HTTP: web backend

  • FUNCTION: FunctionGraph backend

  • MOCK: Mock backend

Enumeration values:

  • HTTP

  • FUNCTION

  • MOCK

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. The value cannot exceed 20,480 characters.

result_failure_sample

String

Example response for a failed request. The value cannot exceed 20,480 characters.

authorizer_id

String

ID of the frontend custom authorizer.

tags

Array of strings

Tags.

The value can contain only letters, digits, and underscores (_), and must start with a letter. You can enter multiple tags and separate them with commas (,).

Minimum: 1

Maximum: 128

response_id

String

Group response ID.

roma_app_id

String

Integration application ID.

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

  • text/plain

Currently, this parameter is not supported.

Enumeration values:

  • application/json

  • application/xml

  • multipart/form-date

  • text/plain

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

Time when the API version is published.

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.

sl_domain

String

Subdomain name that API Gateway automatically allocates to the API group.

sl_domains

Array of strings

Subdomain names that APIG automatically allocates to the API group.

version_id

String

API version ID.

Table 4 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

Enumeration values:

  • DISABLE

  • HEADER

Table 5 BackendApi

Parameter

Type

Description

authorizer_id

String

Backend custom authorizer ID.

url_domain

String

Backend service address.It can consist 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.

Enumeration values:

  • HTTP

  • HTTPS

remark

String

Description. It cannot exceed 255 characters.

req_method

String

Request method.

Enumeration values:

  • GET

  • POST

  • PUT

  • DELETE

  • HEAD

  • PATCH

  • OPTIONS

  • ANY

version

String

Web backend version, which can contain a maximum of 16 characters.

req_uri

String

Request address. It can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), percent signs (%), hyphens (-), and underscores (), 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.> The value must comply with URI specifications.

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.

Default: -1

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 6 ApiGroupCommonInfo

Parameter

Type

Description

id

String

ID.

name

String

API group name.

status

Integer

Status.

  • 1: valid

Enumeration values:

  • 1

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

url_domains

Array of UrlDomain objects

Independent domain names bound to the API group.

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

Enumeration values:

  • TLSv1.1

  • TLSv1.2

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

Table 8 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

Enumeration values:

  • async

  • sync

network_type

String

Function network architecture.

  • V1: non-VPC

  • V2: VPC

Enumeration values:

  • V1

  • V2

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. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000.

Unit: ms.

Minimum: 1

authorizer_id

String

Backend custom authorizer ID.

id

String

ID.

register_time

String

Registration time.

status

Integer

Backend service status.

  • 1: valid

update_time

String

Update time.

Table 9 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 10 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.

Enumeration values:

  • STRING

  • NUMBER

location

String

Parameter location.

Enumeration values:

  • PATH

  • QUERY

  • HEADER

default_value

String

Default value.

sample_value

String

Example value.

required

Integer

Indicates whether the parameter is required. 1: yes 2: no

The value of this parameter is 1 if Location is set to PATH, and 2 if Location is set to another value.

Enumeration values:

  • 1

  • 2

valid_enable

Integer

Indicates whether validity check is enabled.

  • 1: enabled

  • 2: disabled

Default: 2

Enumeration values:

  • 1

  • 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

Enumeration values:

  • 1

  • 2

id

String

Parameter ID.

Table 11 ApiPolicyFunctionResp

Parameter

Type

Description

function_urn

String

Function URN.

invocation_type

String

Invocation mode.

  • async: asynchronous

  • sync: synchronous

Enumeration values:

  • async

  • sync

network_type

String

Function network architecture.

  • V1: non-VPC

  • V2: VPC

Enumeration values:

  • V1

  • V2

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. You can set the maximum timeout using the backend_timeout configuration item. The maximum value is 600,000.

Unit: ms.

Minimum: 1

id

String

ID.

effect_mode

String

Effective mode of the backend policy.

  • ALL: All conditions are met.

  • ANY: Any condition is met.

Enumeration values:

  • ALL

  • ANY

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

Enumeration values:

  • ALL

  • ANY

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

Enumeration values:

  • ALL

  • ANY

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.It can consist 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. The value can be HTTP or HTTPS.

Enumeration values:

  • HTTP

  • HTTPS

req_method

String

Request method. Options: GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, ANY.

Enumeration values:

  • GET

  • POST

  • PUT

  • DELETE

  • HEAD

  • PATCH

  • OPTIONS

  • ANY

req_uri

String

Request address. It can contain request parameters enclosed with brackets ({}). For example, /getUserInfo/{userId}. Special characters, such as asterisks (*), percent signs (%), hyphens (-), and underscores (), 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.> The value must comply with URI specifications.

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.

Default: -1

vpc_channel_info

VpcInfo object

VPC channel details. This parameter is required if vpc_channel_status is set to 1.

vpc_channel_status

Integer

Indicates whether to use a VPC channel.

  • 1: A VPC channel is used.

  • 2: No VPC channel is used.

Table 14 BackendParam

Parameter

Type

Description

origin

String

Parameter type.

  • REQUEST: backend parameter

  • CONSTANT: constant parameter

  • SYSTEM: system parameter

Enumeration values:

  • REQUEST

  • CONSTANT

  • SYSTEM

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.

Enumeration values:

  • PATH

  • QUERY

  • 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 15 CoditionResp

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.

  • exact: exact match

  • enum: enumeration

  • pattern: regular expression

This parameter is required if the policy type is param.

Enumeration values:

  • exact

  • enum

  • pattern

condition_origin

String

Policy type.

  • param: input parameter

  • source: source IP address

Enumeration values:

  • param

  • source

condition_value

String

Condition value.

id

String

ID.

req_param_id

String

Input parameter ID.

req_param_location

String

Input parameter location.

Table 16 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: 401

Table 17 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 18 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 19 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 20 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

None

Example Responses

Status code: 200

OK

{
  "name" : "Api_http",
  "type" : 1,
  "version" : "V0.0.1",
  "req_protocol" : "HTTPS",
  "req_method" : "GET",
  "req_uri" : "/test/http",
  "auth_type" : "AUTHORIZER",
  "auth_opt" : [ {
    "app_code_auth_type" : "DISABLE"
  } ],
  "authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac",
  "cors" : false,
  "match_mode" : "NORMAL",
  "backend_type" : "HTTP",
  "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
  "result_normal_sample" : "Example success response",
  "result_failure_sample" : "Example failure response",
  "id" : "5f918d104dc84480a75166ba99efff21",
  "status" : 1,
  "arrange_necessary" : 2,
  "remark" : "Web backend API",
  "register_time" : "2020-07-31T12:42:51Z",
  "update_time" : "2020-08-02T16:32:47.046289Z",
  "group_name" : "api_group_001",
  "run_env_name" : "RELEASE",
  "run_env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",
  "sl_domain" : "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com",
  "sl_domains" : [ "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com", "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.cn" ],
  "version_id" : "ee1a5a38d3d3493abf1dc4ed6cacfa0b",
  "publish_time" : "2020-08-03T01:36:00Z",
  "backend_api" : {
    "url_domain" : "56a7d7358e1b42459c9d730d65b14e59",
    "req_protocol" : "HTTPS",
    "req_method" : "GET",
    "req_uri" : "/test/benchmark",
    "timeout" : 5000,
    "id" : "1ce8fda3586d4371bd83c955df37e102",
    "status" : 1,
    "register_time" : "2020-07-31T12:42:51Z",
    "update_time" : "2020-08-02T16:32:47.077029Z",
    "vpc_channel_status" : 1,
    "vpc_channel_info" : {
      "cascade_flag" : false,
      "vpc_channel_id" : "56a7d7358e1b42459c9d730d65b14e59",
      "vpc_channel_proxy_host" : "www.example.com",
      "vpc_channel_port" : 0
    },
    "retry_count" : "-1"
  },
  "backend_params" : [ {
    "name" : "X-CONSTANT-HEADER",
    "location" : "HEADER",
    "origin" : "CONSTANT",
    "value" : "demo",
    "remark" : "constant_demo",
    "id" : "8cb2eba19e7a4423a4e835647a8b8d76"
  }, {
    "name" : "app-id",
    "location" : "HEADER",
    "origin" : "SYSTEM",
    "value" : "$context.appId",
    "remark" : "App ID of the API caller",
    "id" : "216ddda836e74d528f364ff589d9dd21"
  } ]
}

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.3022",
  "error_msg" : "The API version does not exist,id:ee1a5a38d3d3493abf1dc4ed6cacfa0b"
}

Status code: 500

Internal Server Error

{
  "error_code" : "APIG.9999",
  "error_msg" : "System error"
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.