Skip to content

获取异步下载视频消息结果 ​

用 异步下载消息中的视频 返回的 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
}

响应参数 ​

参数名类型说明
codestring1000 成功;其他值都是失败,通常是 1001
messagestring反馈信息
dataobject下载结果
data.urlstring下载完成后的视频地址
data.typeint下载状态:0 下载中,1 下载完成,2 下载失败
data.desstring / null描述信息
data.idstring任务 ID