Custom Flow Number Query
https://api.itniotech.com/otp/verification/orderId/record
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" }
Parameters | Description | Type |
---|---|---|
status | Status code, 0 is successful, other failures refer to description of status code | String |
reason | The reason for the failure | String |
data | Response parameter details | JSONObject | -
orderId | Third-party platform stream number, must be globally unique | String |
flowId | Task flow ID | Int |
verifications | Details of the verification result | JSONObject | -
matched | Verification result of verification code [ -1 not verified, 0 verified successfully, 1 sending, 2 verification failed, 3 non-existent verificationId ] | Int |
verifiedDate | Verification time | String |
oriReceiver | Receive number | String |
channel | Channel type [sms, call, sna] | String |
sms | SMS record details, verifications.channel=sms, return this object | JSONArray | -
submitTm | Submit time | String |
sendTm | Send time | String |
doneTm | Completion time | String |
mcc | mcc | Int |
mnc | mnc | Int |
sender | Sender id | String |
chargeCnt | Number of billing entries | Int |
pay | Total cost | String |
status | SMS delivery status -1 being sent, 0 success, 1 failure | Int |
reason | Failure reason description | String |
call | Voice record details, verifications.channel=call, return to this object | JSONArray | -
terminationCode | Sending status 0 success, other failure | Int |
terminationReason | Description of status code | String |
submitTime | Submitted time | String |
callTime | Call time | String |
ringingTime | Ringing time | String |
answerTime | Answer time | String |
hangupTime | Hang up time | String |
callDuration | Call duration | Int |
chargedDuration | Billing time | Int |
displayNum | Display number | String |
billPeriodstring | Billing Period | String |
code | Area Provider | String |
rate | Rate | String |
cost | Consumption amount(USD) | String |
sna | Silent Network Authentication (SNA) Login Record Details, with verifications.channel=sna, return this object | JSONArray | -
postVerificationTime | Request verification time | String |
verificationBackTime | Verification result return time | String |
mcc | mcc | Integer |
mnc | mnc | Integer |
status | Verification status [-1 not verified, 0 successful, 1 failed] | Integer |
reason | Reason description | String |
status | Description |
---|---|
0 | success |
-1 | Authentication error |
-2 | Restricted IP access |
-16 | Timestamp expires |
-18 | Port program unusual |
-22 | Parameter exception |
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 = "your 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 = "your 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[] = 'Content-Type: application/json;charset=UTF-8'; $headers[] = "Sign: $sign"; $headers[] = "Timestamp: $timeStamp"; $headers[] = "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" } ] } }