Updated on 2023-12-19 GMT+08:00

Querying APIs

Function

This API is used to query APIs to return their details and publication information. Backend and request parameter information of the APIs will not be returned.

Calling Method

For details, see Calling APIs.

URI

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Long

Offset from which the query starts. If the value is less than 0, it is automatically converted to 0.

Default: 0

limit

No

Integer

Number of items displayed on each page. A value less than or equal to 0 will be automatically converted to 20, and a value greater than 500 will be automatically converted to 500.

Minimum: 1

Maximum: 500

Default: 20

id

No

String

API ID.

name

No

String

API name.

group_id

No

String

API group ID.

req_protocol

No

String

Request protocol.

req_method

No

String

Request method.

req_uri

No

String

Request path.

auth_type

No

String

Security authentication mode.

env_id

No

String

ID of the environment in which the API has been published.

type

No

Integer

API type.

precise_search

No

String

Parameter name (name or req_uri) for exact matching.

vpc_channel_name

No

String

Load balance channel name.

return_data_mode

No

String

Additional information to be included in the returned API details. Separate multiple parameters with commas (,). "brief" does not take effect when used with any "include" parameters. Currently, only brief, include_group, and include_group_backend are supported. brief: default, indicating that no additional information will be included. include_group: The return result will include api_group_info. include_group_backend: The return result will include backend_api.

Default: brief

Enumeration values:

  • brief
  • include_group
  • include_group_backend

Request Parameters

Table 3 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 4 Response body parameters

Parameter

Type

Description

size

Integer

Length of the returned resource list.

total

Long

Number of resources that match the query conditions.

apis

Array of ApiInfoPerPage objects

API list.

Table 5 ApiInfoPerPage

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

Enumeration values:

  • 1
  • 2

version

String

API version.

Maximum: 16

req_protocol

String

API request protocol:

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

Default: HTTPS

Enumeration values:

  • HTTP
  • HTTPS
  • BOTH

req_method

String

API request method.

Enumeration values:

  • GET
  • POST
  • PUT
  • DELETE
  • HEAD
  • PATCH
  • OPTIONS
  • ANY

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.

  • 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

API matching mode:

  • SWA: Prefix match
  • NORMAL: Exact match Default value: NORMAL

Enumeration values:

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

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. Ensure that the response does not exceed 20,480 characters.

result_failure_sample

String

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

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

Coming soon.

Enumeration values:

  • application/json
  • application/xml
  • multipart/form-data
  • 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

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

Backend information.

api_group_info

ApiGroupCommonInfo object

API group information.

req_params

Array of ReqParam objects

Request parameters.

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

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

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

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

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

Not supported currently.

url_domains

Array of UrlDomain objects

Independent domain names bound to the API group.

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

Status code: 400

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

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

{
  "total" : 3,
  "size" : 3,
  "apis" : [ {
    "arrange_necessary" : 2,
    "id" : "5f918d104dc84480a75166ba99efff21",
    "tags" : [ "webApi" ],
    "backend_type" : "HTTP",
    "auth_type" : "AUTHORIZER",
    "auth_opt" : {
      "app_code_auth_type" : "DISABLE"
    },
    "authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac",
    "cors" : false,
    "status" : 1,
    "group_name" : "api_group_001",
    "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
    "group_version" : "V1",
    "match_mode" : "NORMAL",
    "name" : "Api_http",
    "req_protocol" : "HTTPS",
    "req_method" : "GET",
    "req_uri" : "/test/http",
    "type" : 1,
    "version" : "V0.0.1",
    "register_time" : "2020-07-31T12:42:51Z",
    "update_time" : "2020-08-02T16:32:47.046289Z",
    "remark" : "Web backend API"
  }, {
    "id" : "3a955b791bd24b1c9cd94c745f8d1aad",
    "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",
    "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:52Z",
    "update_time" : "2020-08-02T15:56:52Z",
    "status" : 1
  }, {
    "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",
    "cors" : false,
    "req_protocol" : "HTTPS",
    "req_uri" : "/test/function",
    "remark" : "FunctionGraph backend API",
    "type" : 1,
    "version" : "V0.0.1",
    "status" : 1,
    "req_method" : "GET",
    "tags" : [ "functionApi" ],
    "register_time" : "2020-08-02T15:36:19Z",
    "update_time" : "2020-08-02T15:47:53.499266Z"
  } ]
}

Status code: 400

Bad Request

{
  "error_code" : "APIG.2012",
  "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: 500

Internal Server Error

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

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

500

Internal Server Error

Error Codes

See Error Codes.