Request URL:
https://api.itniotech.com/otp/verification/orderId/record
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "ad454212",
"orderId": "1234566"
}
参数 | 说明 | 类型 |
---|---|---|
status | 状态码,0成功,其他失败参见响应状态码说明 | String |
reason | 失败原因说明 | String |
data | 响应参数详情 | JSONObject |
orderId | 第三方平台流水号,需全局唯一 | String |
flowId | 任务流ID | Int |
verifications | 校验结果详情 | JSONObject |
matched | 验证码的检验结果[ -1未校验 0校验成功 1发送中 2校验失败 3不存在的verificationId ] | Int |
verifiedDate | 校验时间 | String |
oriReceiver | 接收号码 | String |
channel | 通道类型 [sms, call, sna] | String |
sms | 短信记录详情,verifications.channel=sms,返回此对象 | JSONArray |
submitTm | 提交时间 | String |
sendTm | 发送时间 | String |
doneTm | 完成时间 | String |
mcc | mcc | Int |
mnc | mnc | Int |
sender | 发送者id | String |
chargeCnt | 计费条数 | Int |
pay | 总费用 | String |
status | 短信发送状态 -1发送中 0成功 1失败 | Int |
reason | 失败原因描述 | String |
call | 语音记录详情,verifications.channel=call,返回此对象 | JSONArray |
terminationCode | 发送状态 0成功 其他失败 | Int |
terminationReason | 状态码描述 | String |
submitTime | 提交时间 | String |
callTime | 呼叫时间 | String |
ringingTime | 响铃时间 | String |
answerTime | 接听时间 | String |
hangupTime | 挂断时间 | String |
callDuration | 通话时长 | Int |
chargedDuration | 计费时长 | Int |
displayNum | 显示号码 | String |
billPeriodstring | 计费周期 | String |
code | 地区供应商 | String |
rate | 费率(美元) | String |
cost | 消费金额(美元) | String |
sna | 静默网络登录记录详情,verifications.channel=sna,返回此对象 | JSONArray |
postVerificationTime | 请求校验时间 | String |
verificationBackTime | 校验结果返回时间 | String |
mcc | mcc | Integer |
mnc | mnc | Integer |
status | 验证状态[-1未验证、0成功、1失败] | Integer |
reason | 原因说明 | String |
status | 状态说明 |
---|---|
0 | 成功 |
-1 | 账号认证异常 |
-2 | ip限制 |
-16 | 时间戳过期 |
-18 | 系统异常 |
-22 | 参数异常 |
Java
PHP
REQUEST
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
private void getRecordByOrderId() {
final String baseUrl = "https://api.itniotech.com/otp";
final String apiKey = "your api key";
final String apiPwd = "your api secret";
final String url = baseUrl.concat("/verification/orderId/record");
final String appId = "{{appId}}";
final String orderId = "{{orderId}}";
HttpRequest request = HttpRequest.post(url);
// currentTime
final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
// generate md5 key
final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));
request.header(Header.CONNECTION, "Keep-Alive")
.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
.header("Sign", sign)
.header("Timestamp", datetime)
.header("Api-Key", apiKey);
final String params = JSONUtil.createObj()
.set("appId", appId)
.set("orderId", orderId)
.toString();
HttpResponse response = request.body(params).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";
$appId = "{{appId}}";
$url = "https://api.itniotech.com/otp/verification/orderId/record";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$dataArr['appId'] = $appId;
$dataArr['orderId'] = "{{orderId}}";
$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);
curl_close($ch);
var_dump($output);
RESPONSEEXAMPLE
{
"status": "0",
"reason": "success",
"data": {
"orderId": "1234566",
"flowId": 1,
"verifications":
{
"matched": 0,
"verifiedDate": "2022-07-12T13:39:47+08:00",
"oriReceiver": "91856321412",
"channel": "call",
"orderId": "1234566"
},
"sms": [
{
"submitTm": "2022-07-12T13:39:45+08:00",
"sendTm": "2022-07-12T13:39:45+08:00",
"doneTm": "2022-07-12T13:39:49+08:00",
"mcc": 460,
"mnc": 10,
"sender": "",
"chargeCnt": 1,
"pay": "0.000002",
"status": 0,
"reason": "successR"
}
],
"call": [
{
"terminationCode": 100005,
"terminationReason": "Temporarily Unavailable",
"submitTime": "2022-07-12T13:59:55+08:00",
"callTime": "2022-07-12T13:59:56+08:00",
"ringingTime": "2022-07-12T13:59:56+08:00",
"answerTime": "2022-07-12T13:59:56+08:00",
"hangupTime": "2022-07-12T13:59:56+08:00",
"callDuration": 0,
"chargedDuration": 0,
"displayNum": null,
"billPeriodstring": "20+20",
"code": "661",
"rate": "0.138",
"cost": "0"
}
]
}
}