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
GET /v2/{project_id}/apigw/instances/{instance_id}/apis/runtime/{api_id}
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. |
api_id |
Yes |
String |
API ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
env_id |
No |
String |
ID of the environment in which the API is published. |
Request 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
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.
Enumeration values:
|
version |
String |
API version. Maximum: 16 |
req_protocol |
String |
Request protocol.
Default: HTTPS Enumeration values:
|
req_method |
String |
Request method. Enumeration values:
|
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.
Enumeration values:
|
auth_opt |
AuthOpt object |
Security authentication parameter. |
cors |
Boolean |
Indicates whether CORS is supported.
Default: false Enumeration values:
|
match_mode |
String |
Route matching mode.
The default value is NORMAL. Enumeration values:
|
backend_type |
String |
Backend type.
Enumeration values:
|
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:
Currently, this parameter is not supported. Enumeration values:
|
id |
String |
API ID. |
group_name |
String |
Name of the API group to which the API belongs. |
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 |
Publication record ID. |
sl_domain |
String |
Subdomain name of the API group. |
sl_domains |
Array of strings |
Subdomain names that APIG automatically allocates to the API group. |
req_params |
Array of ReqParam objects |
Request parameters. |
Parameter |
Type |
Description |
---|---|---|
app_code_auth_type |
String |
Indicates whether AppCode authentication is enabled. This parameter is valid only if auth_type is set to App. The default value is DISABLE.
Default: DISABLE Enumeration values:
|
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:
|
location |
String |
Parameter location. Enumeration values:
|
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:
|
valid_enable |
Integer |
Indicates whether validity check is enabled.
Default: 2 Enumeration values:
|
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:
|
id |
String |
Parameter ID. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
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", "authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "cors" : false, "match_mode" : "NORMAL", "backend_type" : "HTTP", "remark" : "Web backend API", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "id" : "5f918d104dc84480a75166ba99efff21", "group_name" : "api_group_001", "run_env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID", "run_env_name" : "RELEASE", "publish_id" : "9191cdb430724d4b8586ed7f1b962ca2", "sl_domain" : "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com", "sl_domains" : [ "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com", "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.cn" ] }
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.3002", "error_msg" : "API 5f918d104dc84480a75166ba99efff21 does not exist" }
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.