Updated on 2022-09-01 GMT+08:00

Querying the Runtime Definition of an API

Function

This API is used to query the runtime definition of an API in a specified environment. The runtime definition of an API in the RELEASE environment is queried if no environment is specified.

The definition of an API is classified into the following types:

  • Temporary definition: definition of an API used after the API was last edited.
  • Runtime definition: snapshot of the temporary definition of an API captured when the API is published in an environment.

The runtime definition of an API is accessed when the API is called in an environment.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

GET

/v1.0/apigw/apis/runtime/{id}[?env_id]

  • A combination of different query conditions can be added at the end of the URI by using question marks (?) and ampersands (&).
  • The query condition is env_id.

The following table lists the parameter in the URI.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

id

Yes

String

API ID

Request

Table 3 Parameter description

Parameter

Mandatory

Type

Description

env_id

No

String

ID of the environment in which the API is published

Response

Table 4 Parameter description

Parameter

Type

Description

id

String

API ID

name

String

API name

group_id

String

ID of the API group to which the API belongs

group_name

String

Name of the API group to which the API belongs

type

Integer

API type

version

String

API version

req_protocol

String

Request protocol

req_method

String

Request method

req_uri

String

Access address

auth_type

String

Security authentication mode

auth_opt

Object

Security authentication mode parameter

authorizer_id

String

ID of the frontend custom authorizer

match_mode

String

Matching mode

remark

String

Description of the API

bakend_type

String

Backend type

run_env_name

String

Name of the environment in which the API has been published

run_env_id

String

ID of the environment in which the API has been published

publish_id

String

ID of the publication record

tag

String

Service name tag, which is to be discarded

tags

[]String

API tags

cors

Bool

Indicates whether CORS is supported.

body_remark

String

Description of the API request body, which can be an example request body, media type, or parameter information

result_normal_sample

String

Example response for a successful request

result_failure_sample

String

Example response for a failed request

response_id

String

ID of the gateway response

sl_domain

String

Subdomain name of the API group

sl_domains

Array of strings

List of subdomain names bound to the API group

req_params

Dictionary

Request parameter list

Table 5 Parameter description of req_params

Parameter

Type

Description

id

String

Parameter ID

name

String

Parameter name

type

String

Parameter type

location

String

Parameter location

default_value

String

Default value

sample_value

String

Example value

required

Integer

Indicates whether the parameter is mandatory.

valid_enable

Integer

Indicates whether validity check is enabled.

remark

String

Description of the parameter

enumerations

String

Enumerated value

min_num

Integer

Minimum value, which is valid when the parameter type is NUMBER

max_num

Integer

Maximum value, which is valid when the parameter type is NUMBER

min_size

Integer

Minimum length

max_size

Integer

Maximum length

regular

String

Regular expression validation rule

json_schema

String

JSON validation rule

Table 6 Parameter description of auth_opt

Parameter

Type

Description

app_code_auth_type

String

Indicates whether AppCode authentication is enabled.

Example response:

{
  "name": "market_api01",
  "type": 1,
  "version": "V0.0.1",
  "req_protocol": "HTTPS",
  "req_method": "GET",
  "req_uri": "/test01",
  "auth_type": "APP",
  "auth_opt": {
    "app_code_auth_type": "HEADER"
  },
  "tags": ["APIG-SN-test", "test"],
  "cors": true,
  "match_mode": "NORMAL",
  "backend_type": "MOCK",
  "remark": "market_api01",
  "group_id": "7f848adc971749cda9c6aff3877cfc3e",
  "body_remark": "market_api01",
  "result_normal_sample": "success",
  "result_failure_sample": "",
  "id": "0e51b689e0784bc884f43756bbf34fa5",
  "group_name": "market_group01",
  "run_env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
  "run_env_name": "RELEASE",
  "publish_id": "f07eb9f5e5ba4bbfbe89326f5cae99c7",
  "sl_domain": "61297835ff1e4905b6f635dbcdf1777e.apigw.example.com",
  "sl_domains": ["61297835ff1e4905b6f635dbcdf1777e.apigw.example.com", "61297835ff1e4905b6f635dbcdf1777e.apigw.example.cn"],
  "req_params": [
    {
      "name": "project_id",
      "type": "STRING",
      "location": "PATH",
      "default_value": "",
      "sample_value": "",
      "required": 1,
      "valid_enable": 2,
      "remark": "",
      "enumerations": "",
      "min_num": 0,
      "max_num": 0,
      "min_size": 0,
      "max_size": 0,
      "regular": "",
      "json_schema": "",
      "id": "2a61905ea2304186a9422faba2940735"
    }
  ]
}

Status Codes

Table 7 Status codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found