上行短信查询

POST
https://api.itniotech.com/sms/recordMo
查询指定区间用户回复短信,最大查询时间间隔为一个月,最小起始时间为2022-07-01T00:00:00+08:00。
 
请求参数
参数 说明 是否必填 类型
appId 应用id( 短信-短信应用) String
current 当前页码,1-N Int
size 每页显示数,1-100 Int
params 分页参数 JSONObject
strTime 查询起始时间,ISO8601标准时间格式: 2022-08-01T00:00:00+08:00 String
endTime 查询结束时间,ISO8601标准时间格式: 2022-08-31T00:00:00+08:00 String
 
请求示例
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"
    }
}
 
响应参数
参数 说明 类型
status 状态码,0成功,其他失败参见响应状态码说明 String
reason 失败原因说明 String
data 分页数据 JSONObject
total 总记录条数 Int
size 每页显示数 Int
current 当前页码 Int
pages 总页码 Int
records 数据集合 JSONArray
number 发送号码 String
sendId 发送者id String
receiveTime 接收时间时间,ISO8601标准时间格式: 2022-08-01T00:00:00+08:00 String
content 短信内容 String
mcc mcc Int
mnc mnc Int
operator 运营商名称 String
pricedetail 费用信息 JSONObject
pay 总价 String
chargeCnt 计费条数 Int
currency 币种(USD) String
price 单价 String
 
响应状态码
status 状态说明
0 成功
-1 认证错误
-2 Ip访问受限
-13 用户被锁定
-16 超出时间范围限制
-18 端口程序异常
-22 参数异常
-25 超出时间范围

意见反馈

文档内容是否对您有帮助?

 

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 = "%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

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

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