語音消息記錄批量査詢
https://api.laaffic.com/v3/voice/recordGroupQuery
參數 | 説明 | 是否必填 | 類型 |
---|---|---|---|
current | 當前頁碼,1-N,預設1,不可傳空 | 否 | Int |
size | 每頁顯示數,1-100,預設25,不可傳空 | 否 | Int |
params | 分頁參數 | 是 | JSONObject |
strTime | 查詢起始時間,ISO8601標準時間格式:2022-01-01T00:00:00+08:00 | 是 | String |
endTime | 查詢結束時間,ISO8601標準時間格式:2022-01-31T00:00:00+08:00 | 是 | String |
Request URL:
https://api.laaffic.com/v3/voice/recordGroupQuery
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"current":1,
"size":20,
"params":{
"strTime":"2022-02-18T00:00:00+08:00",
"endTime":"2022-02-19T00:00:00+08:00"
}
}
參數 | 説明 | 類型 |
---|---|---|
status | 狀態碼,0表示成功,其他均爲失敗,詳見狀態碼説明. | String |
reason | 失敗原因説明 | String |
data | 分頁數據 | JSONObject |
total | 總記錄條數 | Int |
size | 每頁顯示數 | Int |
current | 當前頁碼 | Int |
pages | 總頁碼 | Int |
searchCount | 查詢狀態 | Boolean |
records | 數據集合 | JSONArray |
voiceId | 記錄唯一id | String |
callee | 被叫號碼 | String |
displayNum | 顯示號碼 | String |
code | 地區運營商 | String |
submitTime | 提交時間 | String |
callTime | 呼叫時間 | String |
ringingTime | 響鈴時間 | String |
answerTime | 接聽時間 | String |
hangupTime | 掛斷時間 | String |
callDuration | 通話時長(秒) | Int |
chargedDuration | 計費時長(秒) | Int |
terminationCode | sip code,200代表成功建立通話 | String |
terminationReason | 狀態碼描述 | String |
cost | 消費金額(報價幣種) | String |
billPeriod | 計費週期:20+20,60+60 | String |
rate | 費率(報價幣種) | String |
baseCost | 基礎費用(美元) | String |
voiceFileId | 語音檔唯一id,群呼必填 | String |
feedbackValue | 按鍵反饋值(-1:無,非-1:按鍵值) | String |
calledInfo | 被叫資訊,0-1000位字符 | String |
settleRate | 本幣費率(報價幣種非美金時有值) | String |
quoteExchange | 客戶側報價匯率(報價幣種非美金時有值) | String |
currency | 報價幣種,EUR/USD(報價幣種非美金時有值) | String |
settlePay | 本幣消費金額(報價幣種非美金時有值) | String |
狀態碼 | 説明 |
---|---|
0 | 成功 |
-1 | 帳號認證異常 |
-2 | IP訪問受限 |
-16 | 超出時間限制 |
-18 | 系統異常 |
-22 | 參數異常 |
-25 | 超出時間範圍 |
Java
PHP
請求
import cn.hutool.core.codec.Base64;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
public void recordGroupQuery() {
final String baseUrl = "https://api.laaffic.com/v3/voice";
final String apiKey = "your api key";
final String apiPwd = "your api secret";
final Integer current = 1;
final Integer size = 20;
final String strTime = "2022-01-01T00:00:00+08:00";
final String endTime = "2022-01-31T00:00:00+08:00";
final JSONObject params = JSONUtil.createObj()
.set("strTime", strTime)
.set("endTime", endTime);
final String url = baseUrl.concat("/recordGroupQuery");
HttpRequest request = HttpRequest.post(url);
// generate md5 key
final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));
request.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
.header("Sign", sign)
.header("Timestamp", datetime)
.header("Api-Key", apiKey);
final String body = JSONUtil.createObj()
.set("current", current)
.set("size", size)
.set("params", params)
.toString();
HttpResponse response = request.body(body).execute();
if (response.isOk()) {
String result = response.body();
System.out.println(result);
}
}
請求
header('content-type:text/html;charset=utf8');
$apiKey = "your api key";
$apiSecret = "your api secret";
$url = "https://api.laaffic.com/v3/voice/recordGroupQuery";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$dataArr['current'] = 1;
$dataArr['size'] = 20;
$dataArr['params'] = array(
"strTime"=>"2022-01-01T00:00:00+08:00",
"endTime"=>"2022-01-31T00:00:00+08:00",
);
$data = json_encode($dataArr);
$headers = array('Content-Type:application/json;charset=UTF-8',"Sign:$sign","Timestamp:$timeStamp","Api-Key:$apiKey");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_POSTFIELDS , $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$output = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
var_dump($output);
響應示例
{
"status": "0",
"reason": "success",
"data": {
"total": 5,
"size": 20,
"current": 1,
"pages": 1,
"searchCount": true,
"records": [
{
"voiceId": "2203031113381000002",
"callee": "91856321412",
"displayNum": "1008122211",
"code": "Afghanistan(Kandahar)",
"submitTime": "2022-01-18T14:42:40+08:00",
"callTime": "2022-01-18T14:45:42+08:00",
"ringingTime": "2022-01-18T14:42:47+08:00",
"answerTime": "2022-01-18T14:42:50+08:00",
"hangupTime": "2022-01-18T14:42:55+08:00",
"callDuration": 5,
"chargedDuration": 5,
"terminationCode": "200",
"terminationReason": "success",
"cost": "2",
"billPeriod": "20+20",
"rate": "1.2",
"baseCost": "1",
"voiceFileId": "12022022570cc2484c59d4f8b9745d34226285b1e.mp3",
"feedbackValue": "1",
"calledInfo": "calledInfo",
"settleRate": "1.2793",
"quoteExchange": "0.938",
"currency":"EUR",
"settlePay":"1.2793"
}
]
}
}
點擊此處開啟人工服務