Appearance
异步下载消息中的视频
提交视频消息下载任务,接口立即返回任务 ID。下载结果用获取异步下载视频消息结果查询。
接口地址: POST /asynGetMsgVideo
说明与注意
content传回调里的整段 XML,不要只截取部分字段或自己拼。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| msgId | 是 | number | 消息 ID |
| content | 是 | string | 视频消息回调中的 XML 数据 |
请求示例
http
POST {BASE_URL}/asynGetMsgVideo
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "{{wId}}",
"msgId": 1102684153,
"content": "<?xml version=\"1.0\"?><msg><videomsg aeskey=\"cc054b6e3e98fe91a5bb16227de67023\" cdnvideourl=\"304f020100...\" cdnthumburl=\"304f020100...\" length=\"966424\" playlength=\"15\" /></msg>"
}bash
curl -X POST '{BASE_URL}/asynGetMsgVideo' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "{{wId}}",
"msgId": 1102684153,
"content": "<?xml version=\"1.0\"?><msg><videomsg aeskey=\"cc054b6e3e98fe91a5bb16227de67023\" cdnvideourl=\"304f020100...\" cdnthumburl=\"304f020100...\" length=\"966424\" playlength=\"15\" /></msg>"
}'python
import requests
url = "{BASE_URL}/asynGetMsgVideo"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = r"""{
"wId": "{{wId}}",
"msgId": 1102684153,
"content": "<?xml version=\"1.0\"?><msg><videomsg aeskey=\"cc054b6e3e98fe91a5bb16227de67023\" cdnvideourl=\"304f020100...\" cdnthumburl=\"304f020100...\" length=\"966424\" playlength=\"15\" /></msg>"
}"""
resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String url = "{BASE_URL}/asynGetMsgVideo";
String body = "{\n" +
" \"wId\": \"{{wId}}\",\n" +
" \"msgId\": 1102684153,\n" +
" \"content\": \"<?xml version=\\\"1.0\\\"?><msg><videomsg aeskey=\\\"cc054b6e3e98fe91a5bb16227de67023\\\" cdnvideourl=\\\"304f020100...\\\" cdnthumburl=\\\"304f020100...\\\" length=\\\"966424\\\" playlength=\\\"15\\\" /></msg>\"\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer <你的调用凭证>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());php
<?php
$url = '{BASE_URL}/asynGetMsgVideo';
$body = <<<'JSON'
{
"wId": "{{wId}}",
"msgId": 1102684153,
"content": "<?xml version=\"1.0\"?><msg><videomsg aeskey=\"cc054b6e3e98fe91a5bb16227de67023\" cdnvideourl=\"304f020100...\" cdnthumburl=\"304f020100...\" length=\"966424\" playlength=\"15\" /></msg>"
}
JSON;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <你的调用凭证>',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;成功响应
json
{
"code": "1000",
"message": "处理成功",
"data": {
"id": "6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a"
}
}错误响应
json
{
"code": "1001",
"message": "失败",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功;其他值都是失败,通常是 1001 |
| message | string | 反馈信息 |
| data | object | 异步任务信息 |
| data.id | string | 异步下载任务 ID,用于查询下载结果 |