Help Center/ ROMA Connect/ API Reference/ Service Integration APIs/ API Management/ Querying the Runtime Definition of an API
Updated on 2025-03-26 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

GET /v2/{project_id}/apic/instances/{instance_id}/apis/runtime/{api_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference.

instance_id

Yes

String

Instance ID.

api_id

Yes

String

API ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

env_id

No

String

ID of the environment in which the API was published.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

name

String

API name.

The value can contain 3 to 255 characters, including letters, digits, hyphens (-), underscores (_), periods (.), slashes (/), parentheses, and colons (:). The value must start with a letter or digit.

type

Integer

API type.

  • 1: public

  • 2: private

version

String

API version.

req_protocol

String

API request protocol. Options:

  • HTTP

  • HTTPS

  • BOTH: Both HTTP and HTTPS are supported.

  • GRPCS

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. It 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 the URI specifications.

If the request protocol is set to GRPC, the request address is fixed to /.

/apic/health_check is the preset health check path. If req_method is set to GET, req_uri=/apic/health_check is not supported.

NOTE:

The address must comply with the URI specifications.

auth_type

String

API authentication mode. Options:

  • NONE: no authentication

  • APP: App authentication

  • IAM: IAM authentication

  • 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

Whether CORS is supported.

  • TRUE: supported

  • FALSE: not supported

match_mode

String

Match mode of an API.

  • SWA: prefix match

  • NORMAL: exact match (default)

    The default value is NORMAL.

backend_type

String

Backend type. Options:

  • HTTP: web backend

  • FUNCTION: FunctionGraph backend. When backend_type is set to FUNCTION, func_info is mandatory.

  • MOCK: Mock backend. When backend_type is set to MOCK, mock_info is mandatory.

  • GRPC: gRPC backend.

Policy backends are not subject to this parameter.

remark

String

API description, with a maximum of 255 characters.

Angle brackets (<>) are not allowed.

NOTE:

Chinese characters must be in UTF-8 or Unicode format.

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.

result_normal_sample

String

Example response for a successful request.

NOTE:

Chinese characters must be in UTF-8 or Unicode format.

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

result_failure_sample

String

Example response for a failed request.

NOTE:

Chinese characters must be in UTF-8 or Unicode format.

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

authorizer_id

String

ID of the frontend custom authorizer.

tags

Array of strings

Tags

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.

response_id

String

Group response ID.

This parameter is currently not supported.

roma_app_id

String

ID of the integration application to which an API belongs.

This parameter is mandatory when the API group is a global group or when an API is bound to a user-defined domain name.

domain_name

String

User-defined domain name bound to the API. If a user-defined domain name is used, the roma_app_id field is mandatory.

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 scenarios:

  • Custom authentication

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

  • APIs with FunctionGraph backend

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

Automatically allocated subdomain names.

req_params

Array of ReqParam objects

Request parameters.

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

Table 6 ReqParam

Parameter

Type

Description

name

String

Parameter name.

The value can contain letters, digits, hyphens (-), underscores (_), and periods (.) and must start with a letter.

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.

  • 1: The parameter is mandatory.

  • 2: The parameter is optional.

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

remark

String

Description.

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.

This parameter is currently not supported.

json_schema

String

JSON validation rule.

This parameter is currently not supported.

pass_through

Integer

Indicates whether to transparently transmit the parameter.

  • 1: The parameter is transparently transmitted.

  • 2: The parameter is not transparently transmitted.

orchestrations

Array of strings

Request parameter orchestration rules.

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 "Quotas" in ROMA Connect Service Overview.

id

String

Parameter ID.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

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" : "Normal response example",
  "result_failure_sample" : "Failure response example",
  "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.