
# 查看API详情
#### 功能介绍
查看指定的API的详细信息。
#### URI
HTTP/HTTPS请求方法以及URI如下表所示。
表1HTTP/HTTPS请求方法以及URI 
| 请求方法 | URI                   |
|:---|:---|
| GET  | /v1.0/apigw/apis/{id} |
   
URI中的参数说明如下表所示。
表2参数说明 
| 名称 | 是否必选 | 类型     | 说明     |
|:---|:---|:---|:---|
| id | 是    | String | API的编号 |
   
#### 请求消息
无
#### 响应消息
表3参数说明 
| 参数                    | 类型         | 说明                           |
|:---|:---|:---|
| id                    | String     | API编号                        |
| name                  | String     | API名称                        |
| group_id              | String     | API所属分组的编号                   |
| group_name            | String     | API所属分组的名称                   |
| status                | Integer    | API的状态                       |
| type                  | Integer    | API类型                        |
| version               | String     | API版本                        |
| req_protocol          | String     | API访问协议                      |
| req_method            | String     | API请求方式                      |
| req_uri               | String     | API访问地址                      |
| auth_type             | String     | API认证方式                      |
| auth_opt              | 字段数据类型     | API认证方式参数                    |
| authorizer_id         | String     | 前端自定义认证对象的ID                 |
| match_mode            | String     | API匹配方式                      |
| register_time         | Timestamp  | API创建时间                      |
| update_time           | Timestamp  | API修改时间                      |
| remark                | String     | API描述                        |
| bakend_type           | String     | 后端类型                         |
| run_env_name          | String     | 发布的环境名                       |
| run_env_id            | String     | 发布的环境id                      |
| publish_id            | String     | 发布记录的编号                      |
| arrange_necessary     | Integer    | 是否需要编排                       |
| tag                   | String     | 服务名称标签，待废弃字段                 |
| tags                  | \[\]String | 标签                           |
| cors                  | Bool       | 是否支持跨域访问                     |
| body_remark           | String     | API请求体描述，可以是请求体示例、媒体类型、参数等信息 |
| result_normal_sample  | String     | 正常响应示例，描述API的正常返回信息          |
| result_failure_sample | String     | 失败返回示例，描述API的异常返回信息          |
| response_id           | String     | 分组自定义响应ID                    |
| backend_api           | 字典数据类型     | 后端服务：web后端详情                 |
| mock_info             | 字典数据类型     | 后端服务：MOCK详情                  |
| func_info             | 字典数据类型     | 后端服务：函数工作流后端详情               |
| req_params            | 字典数据类型     | API的请求参数列表                   |
| backend_params        | 字典数据类型     | API的后端参数列表                   |
| policy_https          | 字典数据类型     | web策略后端列表                    |
| policy_mocks          | 字典数据类型     | mock策略后端列表                   |
| policy_functions      | 字典数据类型     | 函数工作流策略后端列表                  |
   
表4backend_api参数说明 
| 参数            | 类型        | 说明           |
|:---|:---|:---|
| id            | String    | 编号           |
| status        | Integer   | 状态           |
| url_domain    | String    | 后端endpoint   |
| version       | String    | 版本           |
| req_protocol  | String    | 访问协议         |
| req_method    | String    | 访问方式         |
| req_uri       | String    | 访问地址         |
| timeout       | Integer   | 访问超时时间，单位：毫秒 |
| register_time | Timestamp | 创建时间         |
| update_time   | Timestamp | 修改时间         |
| remark        | String    | 描述           |
| vpc_status    | String    | 是否使用VPC通道    |
| vpc_info      | String    | VPC通道信息      |
| authorizer_id | String    | 后端自定义认证对象的ID |
   
表5mock_info参数说明 
| 参数             | 类型        | 说明   |
|:---|:---|:---|
| id             | String    | 编号   |
| status         | Integer   | 状态   |
| version        | String    | 版本   |
| result_content | String    | 返回结果 |
| register_time  | Timestamp | 创建时间 |
| update_time    | Timestamp | 修改时间 |
| remark         | String    | 描述   |
   
表6func_info参数说明 
| 参数              | 类型        | 说明               |
|:---|:---|:---|
| id              | String    | 编号               |
| status          | Integer   | 状态               |
| version         | String    | 版本               |
| function_urn    | String    | 函数URN            |
| invocation_type | String    | 调用类型：async\|sync |
| register_time   | Timestamp | 创建时间             |
| update_time     | Timestamp | 更新时间             |
| timeout         | Integer   | 超时时间，单位：毫秒       |
| remark          | String    | 描述               |
   
表7req_params参数说明 
| 参数            | 类型      | 说明                                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|
| id            | String  | 参数编号                                                                                                                                                                                                                                                                                                                                                                                                        |
| name          | String  | 参数名称                                                                                                                                                                                                                                                                                                                                                                                                        |
| type          | String  | 参数类型                                                                                                                                                                                                                                                                                                                                                                                                        |
| location      | String  | 参数位置                                                                                                                                                                                                                                                                                                                                                                                                        |
| default_value | String  | 参数默认值                                                                                                                                                                                                                                                                                                                                                                                                       |
| sample_value  | String  | 参数示例值                                                                                                                                                                                                                                                                                                                                                                                                       |
| required      | Integer | 是否必须： - 1：必须  - 2：非必须   |
| valid_enable  | Integer | 是否开启校验                                                                                                                                                                                                                                                                                                                                                                                                      |
| remark        | String  | 描述                                                                                                                                                                                                                                                                                                                                                                                                          |
| enumerations  | String  | 参数枚举值                                                                                                                                                                                                                                                                                                                                                                                                       |
| min_num       | Integer | 参数最小值（参数类型为NUMBER时有效）                                                                                                                                                                                                                                                                                                                                                                                       |
| max_num       | Integer | 参数最大值（参数类型为NUMBER时有效）                                                                                                                                                                                                                                                                                                                                                                                       |
| min_size      | Integer | 参数最小长度                                                                                                                                                                                                                                                                                                                                                                                                      |
| max_size      | Integer | 参数最大长度                                                                                                                                                                                                                                                                                                                                                                                                      |
| regular       | String  | 正则校验规则（暂不支持）                                                                                                                                                                                                                                                                                                                                                                                                |
| json_schema   | String  | JSON校验规则（暂不支持）                                                                                                                                                                                                                                                                                                                                                                                              |
   
表8backend_params参数说明 
| 参数           | 类型     | 说明        |
|:---|:---|:---|
| id           | String | 参数编号      |
| req_param_id | String | 对应的请求参数编号 |
| name         | String | 参数名称      |
| location     | String | 参数位置      |
| origin       | String | 参数类别      |
| value        | String | 参数值       |
| remark       | String | 描述        |
   
表9policy_https参数说明 
| 参数             | 类型      | 说明           |
|:---|:---|:---|
| id             | String  | 编号           |
| name           | String  | 策略后端名称       |
| url_domain     | String  | 策略后端endpoint |
| req_protocol   | String  | 访问协议         |
| req_method     | String  | 访问方式         |
| req_uri        | String  | 访问地址         |
| timeout        | Integer | 访问超时时间，单位：毫秒 |
| vpc_status     | String  | 是否使用VPC通道    |
| vpc_info       | String  | VPC通道信息      |
| effect_mode    | String  | 关联的策略组合模式    |
| conditions     | 字典数据类型  | 策略条件列表       |
| backend_params | 字典数据类型  | 后端参数列表       |
   
表10policy_mocks参数说明 
| 参数             | 类型     | 说明        |
|:---|:---|:---|
| id             | String | 编号        |
| name           | String | 策略后端名称    |
| result_content | String | 返回结果      |
| effect_mode    | String | 关联的策略组合模式 |
| conditions     | 字典数据类型 | 策略条件列表    |
| backend_params | 字典数据类型 | 后端参数列表    |
   
表11policy_functions参数说明 
| 参数              | 类型      | 说明               |
|:---|:---|:---|
| id              | String  | 编号               |
| name            | String  | 策略后端名称           |
| version         | String  | 版本               |
| function_urn    | String  | 函数URN            |
| invocation_type | String  | 调用类型:async\|sync |
| timeout         | Integer | 超时时间，单位：毫秒       |
| effect_mode     | String  | 关联的策略组合模式        |
| conditions      | 字典数据类型  | 策略条件列表           |
| backend_params  | 字典数据类型  | 后端参数列表           |
   
表12conditions参数说明 
| 参数                 | 类型     | 说明          |
|:---|:---|:---|
| id                 | String | 编号          |
| condition_type     | String | 策略条件        |
| condition_value    | String | 策略值         |
| condition_origin   | String | 策略类型        |
| req_param_name     | String | 关联的请求参数对象名称 |
| req_param_id       | String | 关联的请求参数对象编号 |
| req_param_location | String | 关联的请求参数对象位置 |
   
表13auth_opt参数说明 
| 参数                 | 类型     | 说明            |
|:---|:---|:---|
| app_code_auth_type | String | AppCode简易认证类型 |
   
响应消息样例：
```
{
  "name": "test",
  "type": 1,
  "version": "V0.0.1",
  "req_protocol": "HTTPS",
  "req_method": "GET",
  "req_uri": "/test/{tenant_id}",
  "auth_type": "APP",
  "auth_opt": {
    "app_code_auth_type": "DISABLE"
  },
  "tags": ["APIG-SN-test", "test"],
  "cors": false,
  "match_mode": "NORMAL",
  "backend_type": "HTTP",
  "group_id": "f71f69876f90456ca6fd18ed012fdc11",
  "result_normal_sample": "hello world!",
  "id": "81efcfd94b8747a0b21e8c04144a4e8c",
  "status": 1,
  "arrange_necessary": 2,
  "register_time": "2018-08-15T03:41:11.0239936Z",
  "update_time": "2018-08-15T03:41:11.0239936Z",
  "group_name": "group0002",
  "backend_api": {
    "url_domain": "xxxxxxxxxxx",
    "req_protocol": "HTTP",
    "req_method": "GET",
    "req_uri": "/test",
    "timeout": 1000,
    "vpc_status": 2,
    "id": "3442ffd031814e3a8f133a9f1ea08453",
    "status": 1,
    "register_time": "2018-08-15T03:41:11.1019236Z",
    "update_time": "2018-08-15T03:41:11.1019236Z"
  },
  "req_params": [
    {
      "name": "tenant_id",
      "type": "STRING",
      "location": "PATH",
      "required": 1,
      "valid_enable": 2,
      "id": "593c5560e0924e00af08fb458f850ecb"
    },
    {
      "name": "city",
      "type": "STRING",
      "location": "QUERY",
      "required": 2,
      "valid_enable": 2,
      "id": "e0b91bc81ae54f8ea850848d782d6e1e"
    }
  ],
  "backend_params": [
    {
      "name": "tenant_id",
      "location": "QUERY",
      "origin": "REQUEST",
      "value": "tenant_id",
      "id": "44e03de2351e43a8b18ba9ec1e71d2e9",
      "req_param_id": "593c5560e0924e00af08fb458f850ecb"
    },
    {
      "name": "city",
      "location": "QUERY",
      "origin": "REQUEST",
      "value": "city",
      "id": "b60fbcb5b86f4f5c8705c445b9bd6325",
      "req_param_id": "e0b91bc81ae54f8ea850848d782d6e1e"
    }
  ],
  "policy_https": [{
    "conditions": [{
      "id": "44e03de2351e43a8b18ba9ec1e71d2e9",
      "condition_type": "pattern",
      "condition_value": "^[0-9]$",
      "condition_origin": "param",
      "req_param_name": "project_id",
      "req_param_id": "b60fbcb5b86f4f5c8705c445b9sda325",
      "req_param_location": "PATH"
    }],
    "backend_params": [{
      "name": "project_id",
      "value": "bbbb",
      "location": "QUERY",
      "origin": "REQUEST",
      "id": "44e03de2351e43a8b18ba9ec1e71d2e8",
      "req_param_id": "593c5560e0924e00af08fb458f850ecb"
    }],
    "effect_mode": "ANY",
    "id": "44e03de2351e43a8b18ba9ec1e71d2e8",
    "name": "policy001",
    "req_method": "GET",
    "req_protocol": "http",
    "req_uri": "/test/policy",
    "timeout": 10000,
    "url_domain": "xxxxxxxxxxx",
    "vpc_status": 2
  }]
}
```
#### 状态码
表14返回消息说明 
| 状态码 | 说明           |
|:---|:---|
| 200 | OK           |
| 400 | Bad Request  |
| 401 | Unauthorized |
| 403 | Forbidden    |
| 404 | Not Found    |
   
