Skip to content

话单消费详情

请求信息

  • 接口: /agent-api/user/{user_id}/cdr_consumption_detail
  • 请求方式: GET

路由参数

参数类型示例解释必填
user_idstring5433b412-07d5-44e6-9fa4-deb65e43bc93用户id

请求参数

参数类型示例解释必填
pageint1页码否(需要分页时,可传该参数)
datearray["2023-05-08","2023-05-28"]日期否(不传递,默认传递近7天范围数据)
caller_line_idstring701c4d11-84f3-4471-98ab-34f4f376e449线路id
typestringself (self : 主账号 || all :主账号以及所有子账号)类别否(不传递,默认选择 self)

注意:date参数不可传递时间跨度不可超过30天。

请求示例

cURL
curl -X GET "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail?page=1&date[]=2023-05-08&date[]=2023-05-28&caller_line_id=701c4d11-84f3-4471-98ab-34f4f376e449&type=self" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
Go
package main

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

func main() {
    url := "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail?page=1&date[]=2023-05-08&date[]=2023-05-28&caller_line_id=701c4d11-84f3-4471-98ab-34f4f376e449&type=self"

    req, _ := http.NewRequest("GET", url, nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer YOUR_TOKEN")

    client := &http.Client{}
    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');

axios.get('https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail', {
    params: {
        page: 1,
        date: ['2023-05-08', '2023-05-28'],
        caller_line_id: '701c4d11-84f3-4471-98ab-34f4f376e449',
        type: 'self'
    },
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error('Error:', error);
});
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 {
        String url = "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail?page=1&date[]=2023-05-08&date[]=2023-05-28&caller_line_id=701c4d11-84f3-4471-98ab-34f4f376e449&type=self";

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer YOUR_TOKEN")
                .GET()
                .build();

        HttpClient client = HttpClient.newHttpClient();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
PHP
<?php

$url = 'https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail?page=1&date[]=2023-05-08&date[]=2023-05-28&caller_line_id=701c4d11-84f3-4471-98ab-34f4f376e449&type=self';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Authorization: Bearer YOUR_TOKEN'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
Python
import requests

url = 'https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail'

params = {
    'page': 1,
    'date': ['2023-05-08', '2023-05-28'],
    'caller_line_id': '701c4d11-84f3-4471-98ab-34f4f376e449',
    'type': 'self'
}

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

response = requests.get(url, headers=headers, params=params)
print(response.json())
C++
#include <iostream>
#include <string>
#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) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/user/5433b412-07d5-44e6-9fa4-deb65e43bc93/cdr_consumption_detail?page=1&date[]=2023-05-08&date[]=2023-05-28&caller_line_id=701c4d11-84f3-4471-98ab-34f4f376e449&type=self");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");

        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_HTTPHEADER, headers);

        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);

        res = curl_easy_perform(curl);
        curl_slist_free_all(headers);
        curl_easy_cleanup(curl);

        std::cout << readBuffer << std::endl;
    }
    return 0;
}

返回示例

json
{
    "code": 200,
    "status": "success",
    "message": "查看话单消费详情成功",
    "data": [
        {
            "id": 1171,
            "user_id": "073d8501-b6a3-4869-a87e-71807bfd4fb8",
            "record_id": "27f2d152-8af9-4c8c-b8e9-9217c62c8406",
            "task_id": "9f1ef175-b597-416c-92b1-398bab03ef8f",
            "task_name": "测试",
            "caller_line_id": "985b581f-b14d-4d75-9d8e-ef64a6343290",
            "caller_line_name": "22",
            "caller_number": "202310121406", //主叫号码
            "callee": "17838463327", //被叫号码
            "bill": 47980, //通话时长
            "fee": 1, //通话费用
            "agent_fee": 0,
            "calldate": "2023-10-12 18:12:32", //开始时间
            "hangupdate": "2023-10-12 18:13:20", //通话结束时间
            "created_at": "2023-10-12 18:13:26",
            "updated_at": "2023-10-12 18:13:26"
        },
        {
            "id": 1170,
            "user_id": "073d8501-b6a3-4869-a87e-71807bfd4fb8",
            "record_id": "593776a8-949b-4234-9e83-409e109fe37b",
            "task_id": "9f1ef175-b597-416c-92b1-398bab03ef8f",
            "task_name": "测试",
            "caller_line_id": "985b581f-b14d-4d75-9d8e-ef64a6343290",
            "caller_line_name": "22",
            "caller_number": "202310121406",
            "callee": "17838463327",
            "bill": 43859,
            "fee": 1,
            "agent_fee": 0,
            "calldate": "2023-10-12 17:58:47",
            "hangupdate": "2023-10-12 17:59:30",
            "created_at": "2023-10-12 17:59:37",
            "updated_at": "2023-10-12 17:59:37"
        }
    ]
}

基于 MIT 许可发布