# 修改播放域名限制设置

### 接口URL

```
https://api.polyv.net/v2/play/{userid}/domain
```

### 接口说明

```
修改播放域名限制
```

### 支持格式

```
JSON
```

### 请求方式

```
POST
```

### 请求参数

| 参数名         | 必选 | 类型及范围  | 说明                                                                                                                       |
| ----------- | -- | ------ | ------------------------------------------------------------------------------------------------------------------------ |
| userid      | 是  | string | 用户ID，需把实际的userid值替换url中的{userid}                                                                                         |
| ptime       | 是  | long   | 当前时间的毫秒级时间戳（13位），3分钟内有效                                                                                                  |
| sign        | 是  | String | 签名，为40位大写的SHA1值【详见[签名生成规则](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/buildSign/README.md)】 |
| settingType | 是  | int    | 限制类型，0：无域名限制，1：黑名单，2：白名单，3：白名单和黑名单复合限制                                                                                   |
| host        | 否  | string | 域名配置，多个域名以英文逗号分隔，此参数仅在settingType值为1和2时且不为null时有效，最多配置5个域名                                                               |

### 返回正确结果JSON示例

```json
{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": "修改成功."
}
```

### 返回错误结果JSON示例

```json
签名不正确
{
	"code":400,
	"status":"error",
	"message":"the sign is not right",
	"data":""
}
```

```json
时间戳过期
{
	"code":400,
	"status":"error",
	"message":"ptime is too old.",
	"data":""
}
```

### 字段说明

| 字段      | 类型     | 说明   |
| ------- | ------ | ---- |
| code    | int    | 返回码  |
| status  | string | 返回状态 |
| message | string | 返回信息 |
| data    | object | 操作结果 |

#### java请求示例：

```java
    public void testUpdatePlayDomainLimitSetting() throws Exception {
	String url = "https://api.polyv.net/v2/play/{userid}/domain";
        Map<String, String> params = new HashMap<>();
        params.put("userid", userid);
        params.put("ptime", String.valueOf(System.currentTimeMillis()));
        int settingType = 1;
        params.put("settingType", String.valueOf(settingType));
        params.put("host", "a.com,b.com");
        params.put("sign", getSign(params, secretkey));
        String response = HttpClientUtil.getInstance().sendHttpPost(url, params);
        System.out.println(response);
    }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://polyv.gitbook.io/document/docs/unclassified/2021/b8181d9fea4220a3e907e55805565623.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
