# 移动视频到指定分类

### 接口描述

```
1、通过子账号id和视频id，修改视频所属的分类，支持批量修改
2、接口支持https协议
```

### 接口URL

```
http://api.polyv.net/v3/video/update-category
```

[在线API调用](https://git.polyv.net/help-center/document-center/-/blob/master/req.html?api=http:/api.polyv.net/v3/video/update-category/README.md)

### 请求方式

```
POST
```

### 接口约束

1、接口同时支持HTTP 、HTTPS ，建议使用HTTPS 确保接口安全，接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/limit/README.md)

### 请求参数描述

| 参数名       | 必选    | 类型     | 说明                                                                                                                                                                                                                                                                         |
| --------- | ----- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| appId     | true  | String | 保利威点播子账户appId，获取路径：保利威点播后台->设置->账号管理                                                                                                                                                                                                                                       |
| timestamp | true  | Long   | 当前时间的毫秒级时间戳，3分钟内有效                                                                                                                                                                                                                                                         |
| sign      | true  | String | 签名，32位大写MD5值【详见[MD5签名生成规则](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/buildSignMd5/README.md)】                                                                                                                                                |
| vids      | true  | String | <p>视频id，多个视频id用英文逗号分隔，例如：<br>"1b448be32370f4822ac40fd926112a66\_1,1b448be323d66f3dae8db5af9f1fdce6\_1"；<br>获取路径：保利威点播后台->视频列表；<br>也可以获取自【<a href="https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/video_upload/upload_video.md">上传视频</a>】；<br></p> |
| cateId    | false | String | 视频分类id，该参数获取自【[获取分类及子分类](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/video_management/category/get_categories.md)】                                                                                                                             |

### 示例

```requestUrl
http://api.polyv.net/v3/video/update-category
```

表单参数：

```requestUrl
vids=1b448be32370f4822ac40fd926112a66_1%2C1b448be323d66f3dae8db5af9f1fdce6_1&cateId=1617160372987&appId=a0Wmol5EwX&sign=197679CCF105DD80E0378BEF75993D31&timestamp=1617950661602

```

### 响应参数描述

| 参数名       | 类型      | 说明                                                                                                                                                         |
| --------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| code      | Integer | 响应状态码，200为成功返回，非200为失败【详见[全局错误说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/errorInfo/README.md)】                            |
| status    | String  | 响应状态文本信息                                                                                                                                                   |
| requestId | String  | 本次请求的业务流水号，便于客户端/服务器端排查问题                                                                                                                                  |
| error     | Object  | 响应失败时返回错误的详细信息【详见[error字段说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/sub_account/sub_move_video.md?id=error字段说明)】，响应成功时返回空 |
| data      | Object  | 响应成功失败都返回空                                                                                                                                                 |

#### error字段说明

| 字段   | 类型      | 说明                                                                                                            |
| ---- | ------- | ------------------------------------------------------------------------------------------------------------- |
| code | Integer | 错误码                                                                                                           |
| desc | String  | 错误描述【详见[全局错误说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/errorInfo/README.md)】 |

### Java请求示例

快速接入基础代码请下载相关依赖源码， [点击下载源代码](https://git.polyv.net/help-center/document-center/-/blob/master/third_res/util.zip) ,下载后加入到自己的源码工程中即可。测试用例中的**HttpUtil.java 和 VodSignUtil.java** 都包含在下载文件中。

> 强烈建议您使用[点播Java SDK](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/README.md)完成API的功能对接，点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。

```java
private static final Logger log = LoggerFactory.getLogger(VodSubAccountTest.class);

/**
 * 移动视频到指定分类
 * @throws Exception
 * @throws NoSuchAlgorithmException
 */
@Test
public void testMoveSubVideo() throws Exception, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());

        //业务参数
        String url = "http://api.polyv.net/v3/video/update-category";
        String vids = "1b448be32370f4822ac40fd926112a66_1,1b448be323d66f3dae8db5af9f1fdce6_1";
        String cateId = "1617160372987";

        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("vids", vids);
        requestMap.put("cateId", cateId);

        //用md5进行签名，使用子账号的secretKey签名
        requestMap.put("sign", VodSignUtil.getSignMd5(requestMap, appSecret));
        String response = HttpUtil.postFormBody(url, requestMap);
        log.debug("测试移动视频到指定分类,{}", response);
        //do somethings
}


```

### 响应示例

系统全局错误说明详见[全局错误说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/errorInfo/README.md)

成功示例

```json
{
    "requestId": "8faa1225-111d-401c-84c8-b011dd8950a6", 
    "code": 200, 
    "status": "success", 
    "error": null, 
    "data": null
}

```

异常示例

```json
{
    "requestId": "e7544473-250a-40eb-b53b-8768195617e0", 
    "code": 403, 
    "status": "error", 
    "error": {
        "code": 104, 
        "desc": "invalid signature"
    }, 
    "data": null
}

```


---

# 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/vod/api/sub-account/sub_move_video.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.
