# 删除问卷

### 接口URL

```
https://api.polyv.net/live/v3/channel/questionnaire/delete
```

### 接口说明

```
1、接口用于删除问卷
2、接口支持https
```

### 支持格式

```
JSON
```

### 请求方式

```
POST
```

### 请求参数

| 参数名             | 必选 | 类型     | 说明                                                                                                                                                                                                        |
| --------------- | -- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| appId           | 是  | string | 从API设置中获取，在直播系统登记的appId                                                                                                                                                                                   |
| timestamp       | 是  | long   | 当前13位毫秒级时间戳，3分钟内有效                                                                                                                                                                                        |
| sign            | 是  | String | 签名，为32位大写的MD5值,`生成签名的appSecret密钥作为通信数据安全的关键信息，严禁保存在客户端直接使用，所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据`【详见[签名生成规则](https://git.polyv.net/help-center/document-center/-/blob/master/live/api/buildSign/README.md)】 |
| channelId       | 是  | string | 频道号                                                                                                                                                                                                       |
| questionnaireId | 是  | string | 问卷id,修改问卷时需要                                                                                                                                                                                              |

### 响应成功JSON示例：

```json
{
    "code": 200,
    "status": "success",
    "message": "",
    "data": "success"
}
```

### 响应失败JSON示例：

未输入appId

```json
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
```

appId不正确

```json
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
```

时间戳错误

```json
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
```

签名错误

```json
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
```

问卷ID不存在

```json
{
    "code": 400,
    "data": "",
    "message": "questionnaire is not exist",
    "status": "error"
}
```

### 字段说明

| 参数名     | 说明                                  |
| ------- | ----------------------------------- |
| code    | 响应代码，成功为200，失败为400，签名错误为401，异常错误500 |
| status  | 成功为success，失败为error                 |
| message | 错误时为错误提示消息                          |
| data    | 成功提示                                |

### php请求示例

```php
<?php
//引用config.php
include 'config.php';

$params = array(
	'appId' => $appId,
	'timestamp' => $timestamp,
	'channelId' => 206204,
	'questionnaireId' => questionnaireId
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "https://api.polyv.net/live/v3/channel/questionnaire/delete?".http_build_query($params);

function post($url, $post_data = '', $timeout = 5){
	$ch = curl_init();
	curl_setopt ($ch, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_POST, 1);
	if($post_data != ''){
	   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
	}

	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
	$file_contents = curl_exec($ch);
	curl_close($ch);
	return $file_contents;
}

echo post($url,$json);
?>
```
