API: InternationalSMS/Log - 历史明细查询
概览
internationalsms/log 是 SUBMAIL 的历史明细查询API。使用 internationalsms/log 可以实时查询已发送的国际短信历史明细数据。
请注意:
- 该接口请求限制为每分钟1次,时间间隔内返回上一次查询的缓存数据。
- 请注意 start_date(开始日期)和 end_date(结束日期)参数,当有其他筛选条件时,该时间段内查询不到时会返回无记录
URL
https://api-v4.mysubmail.com/internationalsms/log
支持格式
| 格式 | URL |
|---|---|
json | https://api-v4.mysubmail.com/internationalsms/log.json(默认) |
xml | https://api-v4.mysubmail.com/internationalsms/log.xml |
yaml | https://api-v4.mysubmail.com/internationalsms/log.yaml |
http 请求方式
| 请求方式 | content-type设置 |
|---|---|
http post | multipart/form-data、x-www-form-urlencoded、application/json |
是否需要授权
是
参阅 API 授权和验证机制
internationalsms/log 请求参数
| 参数 | 类型 | 必需/可选 | 默认 | 描述 |
|---|---|---|---|---|
appid | string | 必需 | 无 | 在 SUBMAIL 应用集成中创建的国际短信应用ID |
signature | string | 必需 | 无 | 应用密匙或数字签名 参阅 API授权与验证机制 > 授权和验证方式 |
app | string | 可选 | 无 | 指定appid,返回该appid下的发送数据 |
start_date | UNIX 时间戳 | 可选 | 1天前 | 开始时间,unix时间戳,精确到秒 eg:1640100000 |
end_date | UNIX 时间戳 | 可选 | 当前时间 | 结束时间,unix时间戳,精确到秒 eg:1640100000 |
to | string | 可选 | 无 | 查询特定的手机号码 |
send_id | string | 可选 | 无 | 查询特定的 Send ID |
status | string | 可选 | 无 | delivered或dropped,如需查询所有成功的明细请将该参数设置为:delivered,查询失败则传参 dropped |
rows | int | 可选 | 50 | 返回的数据行数 |
offset | int | 可选 | 0 | 数据偏移值(与sql翻页操作方法一致) |
timestamp | UNIX 时间戳 | 可选 | 无 | 参阅 API 授权与验证机制 > Timestamp UNIX 时间戳 |
sign_type | string | 可选 | normal | API 授权模式( 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"
}