# IVR 管理 - 查询IVR呼叫使用TTS模版和变量-v2

#### 接口说明

用于查询批量tts呼叫中的模板及模板对应的变量

#### 请求方式

POST，form-data格式

#### 请求参数

| 参数名        | 类型     | 是否必须 | 说明                                                            |
| :--------- | :----- | :--- | :------------------------------------------------------------ |
| service    | string | 是    | App.Sip_Call.GetTtsTemplate                                    |
| token      | string | 是    | 通过授权接口获取的token                                                         |
| ttsId   | string | 否    | 模板id，精确匹配。|
| currentpage   | int    | 否    | 当前页                                              |
| itemsperpage   | int    | 否    | 每页数量                                             |

#### 接口请求示例（PHP）

```
<?php
    $apiUrl = 'http://127.0.0.1:8080';
    $postFields = [
        'service'   => 'App.Sip_Call.GetTtsTemplate',
        'token'     => 'ABCDEFG',
        'ttsId'  => '111111',
    ];
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $apiUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($curl);
    $curlError = curl_error($curl);
    curl_close($curl);
    var_dump($response);
?>

```

#### 返回数据结构示例

```
{
    "ret": 200, 
    "data": {
        "status": 0, 
        "desc": "成功", 
        "result": {
            "totalitems": 2, 
            "currentpage": 1, 
            "itemsperpage": 10, 
            "templates": [
                {
                    "id": 12, 
                    "name": "订单提醒", 
                    "type": "2", 
                    "content": "Hello {name}, your code is {code}.", 
                    "variables": [
                        "name", 
                        "code"
                    ]
                }, 
                {
                    "id": 11, 
                    "name": "固定通知", 
                    "type": "1", 
                    "content": "Hello, this is a reminder.", 
                    "variables": [ ]
                }
            ]
        }, 
        "reqtime": 1764500000, 
        "rsptime": 1764500001
    }, 
    "msg": ""
}

```

#### 返回参数说明

| 参数名      | 类型     | 说明         |
| :------- | :----- | :--------- |
| code     | int    | 返回码 200 成功 |
| msg      | string | 返回提示信息     |
| data     | object | 返回数据对象     |
| —desc    | string | 请求提示信息     |
| —reqtime | int    | 请求时间戳      |
| —rsptime | int    | 返回时间戳      |