Appearance
获取异步下载视频消息结果
用 异步下载消息中的视频 返回的 data.id 查视频下载进度和结果。
接口地址: POST /getMsgVideoRes
说明与注意
- 结果在服务端只保留 10 分钟,状态每更新一次重新计时。过期再查返回「id不存在或已过期」,要重新提交下载任务。
type为0时继续查,不要重复提交下载任务;为2时失败原因看des。- 也可以不轮询:下载完成后会推送
30002下载消息视频完成通知,内容和本接口返回的data相同。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| id | 是 | string | 异步下载任务 ID |
请求示例
http
POST {BASE_URL}/getMsgVideoRes
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"id": "6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a"
}bash
curl -X POST '{BASE_URL}/getMsgVideoRes' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"id": "6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a"
}'python
import requests
url = "{BASE_URL}/getMsgVideoRes"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"id": "6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a"
}"""
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}/getMsgVideoRes";
String body = "{\n" +
" \"id\": \"6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a\"\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}/getMsgVideoRes';
$body = <<<'JSON'
{
"id": "6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a"
}
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": {
"url": "https://cdn.e-yun.example/msgVideo/f0aa717e-4c34-4185-a420-c831fa40be94.mp4",
"type": 1,
"des": null,
"id": "6eb5d834-1dfe-47ad-b7a5-b9f2fb60a35a"
}
}错误响应
json
{
"code": "1001",
"message": "失败",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功;其他值都是失败,通常是 1001 |
| message | string | 反馈信息 |
| data | object | 下载结果 |
| data.url | string | 下载完成后的视频地址 |
| data.type | int | 下载状态:0 下载中,1 下载完成,2 下载失败 |
| data.des | string / null | 描述信息 |
| data.id | string | 任务 ID |