Two-Way SMS Inquire

POST

https://api.itniotech.com/sms/recordMo

Query the user specified interval reply message, the biggest query time interval for a month, the minimum starting time for the 2022-07-01 T00:00:00 + 08:00.
 
Request Parameters
Parameters Description Required Type
appId App ID (SMS-SMS APP) Yes String
current Current page number: 1-N Yes Int
size Number displayed on each page: 1-100 Yes Int
params Parameters on each page Yes JSONObject
strTime Starting time of inquiry ISO8601 standard time format 2022-08-01T00:00:00+08:00 Yes String
endTime Ending time of inquiry ISO8601 standard time format 2022-08-31T00:00:00+08:00 Yes String
 
Request Sample
Request URL: 
    https://api.itniotech.com/sms/recordMo
Request Method: 
    POST
Request Headers:
    Content-Type:  application/json;charset=UTF-8
    Sign:  05d7a50893e22a5c4bb3216ae3396c7c
    Timestamp:  1630468800
    Api-Key:  bDqJFiq9
Request Body:
{
    "appId": "4luaKsL2",
    "current":1,
    "size":10,
    "params":{
        "strTime":"2022-08-01T00:00:00+08:00",
        "endTime":"2022-08-31T00: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
records Data set JSONArray
number Sender number String
sendId Send id String
receiveTime Received time of inquiry ISO8601 standard time format 2022-08-01T00:00:00+08:00 String
content SMS content String
mcc mcc Int
mnc mnc Int
operator Operator String
pricedetail Fee details JSONObject
pay Total cost String
chargeCnt Number of billing entries Int
currency Currency(USD) String
price Unit String
 
Response Status Code
status Description
0 success
-1 Authentication error
-2 Restricted IP access
-13 User locked
-16 Timestamp expires
-18 port program unusual
-22 Parameter exception
-25 Out of time range
 

language

Java

PHP

REQUEST

package com.itniotech.api.demo.sms;

import cn.hutool.core.util.StrUtil;
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.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

private void recordMo() {
    final String baseUrl = "https://api.itniotech.com/sms";
    final String apiKey = "your api key";
    final String apiPwd = "your api secret";
    final String appId = "your appid";

    final String current = "1";
    final String size = "10";

    final String url = baseUrl.concat("/recordMo");
    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.CONTENT_TYPE, "application/json;charset=UTF-8")
            .header("Sign", sign)
            .header("Timestamp", datetime)
            .header("Api-Key", apiKey);

    final Map timeParams = new HashMap<>();
    timeParams.put("strTime", "2023-06-01T00:00:00+08:00");
    timeParams.put("endTime", "2023-06-31T00:00:00+08:00");

    final String params = JSONUtil.createObj()
            .set("appId", appId)
            .set("current", current)
            .set("size", size)
            .set("params", timeParams)
            .toString();

    HttpResponse response = request.body(params).execute();
    if (response.isOk()) {
        String result = response.body();
        System.out.println(result);
    }
}
        
                

REQUEST

$apiKey = "your api key";
$apiSecret = "your api secret";
$appId = "your appid";
$url = "https://api.itniotech.com/sms/recordMo";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);

$dataArr['appId'] = $appId;
$dataArr['current'] = "1";
$dataArr['size'] = "10";
$dataArr['params'] = array("strTime"=>"2023-06-01T00:00:00+08:00", "endTime"=>"2023-06-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);
curl_close($ch);
var_dump($output);
        
                
 

RESPONSEEXAMPLE

                    {
    "status": "0",
    "reason": "success",
    "data": {
    "total": 2,
        "size": 10,
        "current": 1,
        "pages": 1,
        "records": [
            {
                "number": "91856321412",
                "sendId": "sendId",
                "receiveTime": "2022-06-01T17:41:07+08:00",
                "content": "hello",
                "mcc": 404,
                "mnc": -1,
                "operator": "India",
                "pricedetail": {
                    "pay": "0.1",
                    "chargeCnt": 1,
                    "currency": "USD",
                    "price": "0.1"
                }
            }
        ]
    }
}