Inquire Voice Message Records by Batch

POST

https://api.itniotech.com/voice/recordGroupQuery

Query voice message record information in batches with paging (for recent two months. The maximum interval between the starting time and the ending time is 31 days).
 
Request Parameters
Parameters Description Required Type
current Current page number: 1-N, default 1, cannot be passed empty No Int
size Number displayed on each page: 1-100, default 25, cannot be passed empty No Int
params Parameters on each page Yes JSONObject
strTime Starting time of inquiry ISO8601 standard time format 2022-01-01T00:00:00+08:00 Yes String
endTime Ending time of inquiry ISO8601 standard time format 2022-01-31T00:00:00+08:00 Yes String
 
Request Sample
Request URL:
    https://api.itniotech.com/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"
    }
}
 
Response Parameters
Parameters Description Type
status "0"means successful, others than 0 means failure, seeing Status Code description. String
reason Failure reason description String
data Data on each page JSONObject
total Total record number Int
size Number displayed on each page Int
current Current page number Int
pages Total pages Int
searchCount Total pages Boolean
records Data set JSONArray
voiceId Exclusive recording ID String
callee Called number String
displayNum Display name String
code Operator's area String
submitTime Submitting time String
callTime Calling time String
ringingTime Ringing time String
answerTime Answering time String
hangupTime Hanging-up time String
callDuration Call duration (second) Int
chargedDuration Charged duration (second) Int
terminationCode Sip code, 200 means the call is successfully established String
terminationReason Status code description String
cost Consumption amount (USD) String
billPeriod Billing period: 20+20, 60+60 String
rate Rate (Currency of quotation) String
baseCost Basic cost (USD) String
voiceFileId Exclusive ID of recording file String
feedbackValue Button feedback (-1:nothing; non-1: button) String
calledInfo Called information, 0-1000 characters String
settleRate Local currency rate (valued when the quoted currency is not USD) String
quoteExchange Client-side quoted exchange rate (valued when the quoted currency is not USD) String
settlePay Consumption amount in local currency (valued when the quoted currency is not USD) String
currency Quoted currency, EUR/USD (valued when the quoted currency is not USD) String
 
Response Status Code
status Description
0 success
-1 Authentication error
-2 Restricted IP access
-16 Timestamp expires
-18 Port program unusual
-22 Parameter exception
-25 Out of time range
 

language

Java

PHP

REQUEST

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.itniotech.com/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);
    }
}
        
                

REQUEST

header('content-type:text/html;charset=utf8');

$apiKey = "your api key";
$apiSecret = "your api secret";

$url = "https://api.itniotech.com/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);
        
                
 

RESPONSEEXAMPLE

{
    "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"
            }
        ]
    }
}