Appearance
下载通话录音
接口信息
- 接口:
/agent-api/user/{user_id}/task/{task_id}/record/{record_id}/download-full-voice - 请求方式:
GET
请求说明
注意
原请求地址为GET /agent-api/task/{task_id}/record/{record_id}/download-full-voice,新增参数用户id,且为必填 如果仍使用老版本的接口,将使用系统默认的云节点ID,无法操作其他云节点的数据 老版接口将于2023年2月1日下线,请尽快进行更换
路由参数
请求参数
| 参数 | 类型 | 描述 |
|---|---|---|
| sub_user_id | string | 子账户ID |
请求示例
cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice", nil)
if err != nil {
panic(err)
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer YOUR_TOKEN")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}JavaScript
const axios = require('axios');
const response = await axios.get(
'https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice',
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
}
);
console.log(response.data);Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer YOUR_TOKEN")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;Python
import requests
url = 'https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.get(url, headers=headers)
print(response.json())C++
#include <iostream>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/user/4d99d91c-f5d9-49da-88da-758977cc58a9/task/287e19c4-1966-49d6-8f02-b53ef11c0a55/record/50971322-2e84-4701-836c-fd1181306885/download-full-voice");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
else
std::cout << readBuffer << std::endl;
curl_easy_cleanup(curl);
}
return 0;
}成功响应
条件:任务存在、账号存在、通话记录存在。
状态码:200 OK
json
{
"code": 200,
"status": "success",
"message": "返回录音下载地址成功",
"data": {
"voice_url": "hw.test-saas.our.top/api/agent-api/download-voice?key=N0dJNlFVTFU1WHlsNkoyY1lLZnQwTnNiR2NGQTFva1FGK1pvWURGZmhTTkxqbzBqMHhqMXFEWXQrTWN0ZFZFcTNuMGd5dW9CUm9ycjUyUk9Eam1iTTBsQ0JLQ3BSanVRZGNRVUVuRGMrRHBYYndmc3VVY0lscjlubXhUTmZGSkJ3L0J5RVNnYldFSkZWSmlnV3VqRHJEQWkyWlNrcDhjUTljSVQxNmpQNzRNSTJtYWc3YkJaSmNqa1g3WlR6MTdyQTNXVFJMa2FmcStYWU9wR1h2MDdNdz09"
}
}错误响应
错误1
条件:任务ID不存在。
状态码:200 OK
json
{
"code": 5002,
"status": "error",
"message": "任务不存在",
"data": []
}错误2
条件:账号ID错误,云节点不存在。
状态码:200 OK
json
{
"code": 1002,
"status": "error",
"message": "【user】参数错误,未找到对应云节点",
"data": []
}错误3
条件:通话记录ID不存在。
状态码:200 OK
json
{
"code": 5005,
"status": "error",
"message": "该任务下的该通通话记录不存在",
"data": []
}