# 查询事务 - ShowTemp
#### 功能介绍
查询事务
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/CPTS/doc?api=ShowTemp)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-cpts/cpts_api_0019.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                                      | 访问级别 | 资源类型（\*为必须） | 条件键                       | 别名 | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | codeartsperftest:cpts:getPerfTestProject | Read | cpts \*     | g:ResourceTag/\<tag-key\> | -  | -      |
     
  
 
#### URI
GET /v1/{project_id}/templates/{template_id}
表1路径参数 
| 参数          | 是否必选 | 参数类型    | 描述                                                                              |
|:---|:---|:---|:---|
| project_id  | 是    | String  | 表示项目ID，参见[获取方法说明](https://support.huaweicloud.com/api-cpts/cpts_api_0017.html)。 |
| template_id | 是    | Integer | 事务ID，通过"创建事务"接口获取响应体中的tempId字段的值。                                               |
   
#### 请求参数
无
#### 响应参数
**状态码：200**
表2响应Body参数 
| 参数        | 参数类型                                            | 描述   |
|:---|:---|:---|
| code      | String                                          | 响应码  |
| message   | String                                          | 响应消息 |
| temp_info | [TempInfo] object | 事务详情 |
   
 表3TempInfo 
| 参数               | 参数类型                                                          | 描述                                |
|:---|:---|:---|
| id               | Integer                                                       | 事务ID，通过"创建事务"接口获取响应体中的tempId字段的值。 |
| project_id       | Integer                                                       | 工程ID                              |
| name             | String                                                        | 事务名称                              |
| description      | String                                                        | 事务描述                              |
| variables        | String                                                        | 变量                                |
| contents         | Array of objects                                              | 事务脚本信息                            |
| temp_type        | Integer                                                       | 事务类型（弃用）                          |
| for_loop_params  | Array of objects                                              | 旧版本逻辑控制器字段，当前已不使用                 |
| logic_controller | [LogicController] object | 逻辑控制器信息                           |
| enable_pre       | Boolean                                                       | 是否启用预置事务，当前版本已不使用                 |
   
 表4LogicController 
| 参数              | 参数类型   | 描述                |
|:---|:---|:---|
| for_loop_params | String | 旧版本逻辑控制器字段，当前已不使用 |
| condition       | String | 逻辑控制器条件           |
   
**状态码：501**
表5响应Body参数 
| 参数 | 参数类型   | 描述               |
|:---|:---|:---|
| -  | String | response message |
   
#### 请求示例
查询事务的详情信息，事务的id是1。
```
/v1/{project_id}/templates/1
{
  "code" : "SVCSTG.CPTS.0000000",
  "message" : "success",
  "temp_info" : {
    "id" : 155175,
    "project_id" : 403931,
    "name" : "test",
    "description" : "",
    "variables" : null,
    "contents" : [ {
      "content_id" : 155175,
      "content" : [ {
        "content_type" : 2,
        "content" : {
          "body_type" : 0,
          "bodys" : [ ],
          "check_end_length" : null,
          "check_end_str" : null,
          "check_end_type" : null,
          "connect_timeout" : 5000,
          "connect_type" : 1,
          "headers" : [ {
            "key" : "Content-Type",
            "value" : "application/json"
          } ],
          "http_version" : "HTTP/1.1",
          "method" : "GET",
          "name" : "Msg-8015",
          "protocol_type" : 1,
          "return_timeout" : 5000,
          "return_timeout_param" : null,
          "url" : "http://1.1.1.1"
        }
      } ],
      "index" : -1,
      "selected_temp_name" : "",
      "data" : null,
      "data_type" : 0,
      "conditions" : null,
      "is_disabled" : false,
      "is_continue" : false
    } ],
    "temp_type" : 0,
    "for_loop_params" : [ ],
    "logic_controller" : {
      "for_loop_params" : null,
      "condition" : null
    },
    "enable_pre" : false
  }
}
```
#### 响应示例
**状态码：200**
```
{
  "code" : "SVCSTG.CPTS.0000000",
  "message" : "success",
  "temp_info" : {
    "id" : 21531,
    "project_id" : 17543,
    "name" : "transaction",
    "description" : "",
    "variables" : null,
    "contents" : [ {
      "content_id" : 21531,
      "content" : [ {
        "content_type" : 2,
        "content" : {
          "body_type" : 0,
          "bodys" : [ ],
          "check_end_length" : null,
          "check_end_str" : null,
          "check_end_type" : null,
          "connect_timeout" : 5000,
          "connect_type" : 1,
          "headers" : [ {
            "key" : "Content-Type",
            "value" : "application/json"
          } ],
          "http_version" : "HTTP/1.1",
          "method" : "GET",
          "name" : "Msg-73387",
          "protocol_type" : 2,
          "return_timeout" : 5000,
          "return_timeout_param" : null,
          "url" : "https://www.domain-example.com"
        }
      } ],
      "index" : -1,
      "selected_temp_name" : "",
      "data" : null,
      "data_type" : 0,
      "conditions" : null,
      "is_disabled" : false,
      "is_continue" : false
    } ],
    "temp_type" : 0,
    "for_loop_params" : [ ],
    "logic_controller" : {
      "for_loop_params" : null,
      "condition" : null
    },
    "enable_pre" : false
  }
}
```
#### 状态码
| 状态码 | 描述            |
|:---|:---|
| 200 | success       |
| 501 | unknown error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-cpts/ErrorCode.html)。
