Skip to content

批量播放通话录音地址

接口信息

  • 接口: /agent-api/user/{user_id}/task/{task_id}/batch_record/download-full-voice
  • 请求方式: GET

路由参数

参数类型示例解释必填
user_idstring5433b412-07d5-44e6-9fa4-deb65e43bc93用户 id(主账户)
task_idstring00012192-653c-42d2-818e-27b541f7c764任务 id

请求参数:

参数类型示例解释必填
recordIdsarray["00075047-af8b-4e92-a897-e4ac382acc6a"]通话记录 id(最大传递 30 个通话记录)
sub_user_idstring1181ffd3-e3ee-4d75-a45c-8b9be3deb330子账户 id(传递此参数则是对子账户操作)

请求示例

cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/task/00012192-653c-42d2-818e-27b541f7c764/batch_record/download-full-voice?recordIds[]=00075047-af8b-4e92-a897-e4ac382acc6a&recordIds[]=00075047-af8b-4e92-a897-e4ac382acc7a" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
Go
package main

import (
    "fmt"
    "io"
    "net/http"
    "net/url"
)

func main() {
    baseURL := "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/task/00012192-653c-42d2-818e-27b541f7c764/batch_record/download-full-voice"

    params := url.Values{}
    params.Add("recordIds[]", "00075047-af8b-4e92-a897-e4ac382acc6a")
    params.Add("recordIds[]", "00075047-af8b-4e92-a897-e4ac382acc7a")

    fullURL := baseURL + "?" + params.Encode()

    client := &http.Client{}
    req, err := http.NewRequest("GET", fullURL, 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 userId = "5433b412-07d5-44e6-9fa4-deb65e43bc93";
const taskId = "00012192-653c-42d2-818e-27b541f7c764";
const recordIds = [
    "00075047-af8b-4e92-a897-e4ac382acc6a",
    "00075047-af8b-4e92-a897-e4ac382acc7a"
];

const params = new URLSearchParams();
recordIds.forEach(id => params.append("recordIds[]", id));

const url = `https://ai.api.longlonglong.cn/agent-api/user/${userId}/task/${taskId}/batch_record/download-full-voice?${params}`;

const response = await fetch(url, {
    method: "GET",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_TOKEN"
    }
});

const data = await response.json();
console.log(data);
Java
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.*;
import java.nio.charset.StandardCharsets;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException, InterruptedException {
        String baseUrl = "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/task/00012192-653c-42d2-818e-27b541f7c764/batch_record/download-full-voice";
        String params = "recordIds[]=00075047-af8b-4e92-a897-e4ac382acc6a&recordIds[]=00075047-af8b-4e92-a897-e4ac382acc7a";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(baseUrl + "?" + params))
            .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

$userId = "5433b412-07d5-44e6-9fa4-deb65e43bc93";
$taskId = "00012192-653c-42d2-818e-27b541f7c764";
$recordIds = [
    "00075047-af8b-4e92-a897-e4ac382acc6a",
    "00075047-af8b-4e92-a897-e4ac382acc7a"
];

$params = http_build_query([
    'recordIds' => $recordIds
]);

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://ai.api.longlonglong.cn/agent-api/user/{$userId}/task/{$taskId}/batch_record/download-full-voice?{$params}",
    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

user_id = "5433b412-07d5-44e6-9fa4-deb65e43bc93"
task_id = "00012192-653c-42d2-818e-27b541f7c764"
url = f"https://ai.api.longlonglong.cn/agent-api/user/{user_id}/task/{task_id}/batch_record/download-full-voice"

params = {
    "recordIds[]": [
        "00075047-af8b-4e92-a897-e4ac382acc6a",
        "00075047-af8b-4e92-a897-e4ac382acc7a"
    ]
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.get(url, params=params, 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");

        std::string url = "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/task/00012192-653c-42d2-818e-27b541f7c764/batch_record/download-full-voice?recordIds[]=00075047-af8b-4e92-a897-e4ac382acc6a&recordIds[]=00075047-af8b-4e92-a897-e4ac382acc7a";

        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
        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_slist_free_all(headers);
        curl_easy_cleanup(curl);
    }
    return 0;
}

成功响应

条件:任务存在、账号存在、通话记录存在。

状态码:200 OK

json
{
    "code": 200,
    "status": "success",
    "message": "批量返回录音下载地址成功",
    "data": {
        "batch_url": [
            {
                "record_id": "00075047-af8b-4e92-a897-e4ac382acc6a",
                "voice_url": "saas.test/api/agent-api/download-voice?key=WnlxdFdFajZ0OWs3VUFpbjFKU1lUV2dGWWl2VVhRUWFsSUo5b1BvMXVlTitUUndQTWlNK2Z0NkpGL3Y2NUdNMTNuMGd5dW9CUm9ycjUyUk9Eam1iTTJYSHRUNUtRVjFKdTUzTVpGVm1KQm01VzJMMVZyRSsrVHVGQ2xKZi9wc1FiVmZxWU1BMlpkTTBoSndCWitIMTl5b042bEhHUmRTaHRPWW9IZlNGemMwVm9LYmNYZ0tzU2Z5aElzUTloeDh5c25idkp5cWVaREQramJvMUZFeFVXZz09"
            }
        ]
    }
}

错误响应

错误1

条件:任务ID不存在。

状态码:200 OK

json
{
    "code": 5002,
    "status": "error",
    "message": "任务不存在",
    "data": []
}

错误2

条件:通话记录ID不存在。

状态码:200 OK

json
{
    "code": 50051,
    "status": "error",
    "message": "该任务下的通话记录ID-27777777777777777-不存在",
    "data": []
}

错误3

条件:通话记录ID-录音不存在。

状态码:200 OK

json
{
    "code": 50061,
    "status": "error",
    "message": "通话记录ID-00075047-af8b-4e92-a897-e4ac382acc7a-录音不存在",
    "data": []
}

基于 MIT 许可发布