API: InternationalSMS/Log - 历史明细查询


概览


internationalsms/log 是 SUBMAIL 的历史明细查询API。使用 internationalsms/log 可以实时查询已发送的国际短信历史明细数据。

请注意:

  • 该接口请求限制为每分钟1次,时间间隔内返回上一次查询的缓存数据。
  • 请注意 start_date(开始日期)和 end_date(结束日期)参数,当有其他筛选条件时,该时间段内查询不到时会返回无记录


URL


https://api-v4.mysubmail.com/internationalsms/log


支持格式


格式URL
jsonhttps://api-v4.mysubmail.com/internationalsms/log.json(默认)
xmlhttps://api-v4.mysubmail.com/internationalsms/log.xml
yamlhttps://api-v4.mysubmail.com/internationalsms/log.yaml


http 请求方式


请求方式content-type设置
http postmultipart/form-datax-www-form-urlencodedapplication/json


是否需要授权


参阅 API 授权和验证机制


internationalsms/log 请求参数


参数类型必需/可选默认描述
appidstring必需在 SUBMAIL 应用集成中创建的国际短信应用ID
signaturestring必需应用密匙或数字签名
参阅 API授权与验证机制 > 授权和验证方式
appstring可选指定appid,返回该appid下的发送数据
start_dateUNIX 时间戳可选1天前开始时间,unix时间戳,精确到秒 eg:1640100000
end_dateUNIX 时间戳可选当前时间结束时间,unix时间戳,精确到秒 eg:1640100000
tostring可选查询特定的手机号码
send_idstring可选查询特定的 Send ID
statusstring可选delivereddropped,如需查询所有成功的明细请将该参数设置为:delivered,查询失败则传参 dropped
rowsint可选50返回的数据行数
offsetint可选0数据偏移值(与sql翻页操作方法一致)
timestampUNIX 时间戳可选参阅 API 授权与验证机制 > Timestamp UNIX 时间戳
sign_typestring可选normalAPI 授权模式( md5 or sha1 or normal
参阅 API 授权与验证机制 > 授权和验证方式


代码示例


发送 CURL请求
curl -d "appid=your_appid&signature=your_appkey" https://api-v4.mysubmail.com/internationalsms/log


返回
{
    "status": "success", //API请求状态
    "start_date": 1644152198, //日志查询开始日期
    "end_date": 1644238598,    //日志查询结束日期
    "total": 724,    // 记录数
    "offset": 0, // 数据偏移值
    "results": 50, //每页行数
    "data": [ //数据
           {
            "sendID": "7652bdd4f9b31aa76a7dfa4dfb3cea93",
            "to": "+60133026909",
            "appid": "001001",
            "template_id": "CJSyf2",
            "sms_signature": "",
            "sms_content": "[SUBMAIL]Your verification code is 123456",
            "fee": 0.0431,
            "status": "delivered",
            "ip_address": "127.0.0.1",
            "send_at": 1789340525,
            "sent_at": 1789369325,
            "report_at": 1789369333,
            "country": "Malaysia",
            "country_cn": "马来西亚",
            "country_code": "60",
            "country_area_code": "MY",
            "area": "亚洲",
            "sms_count": 1,
            "sms_type": 1,
            "sender": "SUBMAIL"
        },
        {…………}
        ]
}


请求失败
{
"status":"error",
"code":"1xx",
"msg":"error message"
}


错误代码


参阅 API 错误代码