API: InternationalSMS/BatchSend - 國際短信批量群發(fā)
概覽
internationalsms/batchsend
是 SUBMAIL 的批量國際短信發(fā)送接口。與 internationalsms/send 接口相似,在請求中自由提交短信內容,to (聯系人)參數可以批量提交聯系人手機號碼(單次請求最大支持 10000 個)大幅提高群發(fā)需求的發(fā)送效率。
URL
https://api-v4.mysubmail.com/internationalsms/batchsend
支持格式
格式 | URL |
---|---|
json | https://api-v4.mysubmail.com/internationalsms/batchsend.json (默認) |
xml | https://api-v4.mysubmail.com/internationalsms/batchsend.xml |
yaml | https://api-v4.mysubmail.com/internationalsms/batchsend.yaml |
http 請求方式
請求方式 | content-type 支持 |
---|---|
http post | multipart/form-data、x-www-form-urlencoded、application/json |
是否需要授權
是
參閱 API 授權和驗證機制
internationalsms/batchsend 方法請求參數
參數 | 類型 | 必需/可選 | 默認 | 描述 |
---|---|---|---|---|
appid | string | 必需 | 無 | 在 SUBMAIL 應用集成中創(chuàng)建的短信應用ID |
to | string | 必需 | 無 | 收件人手機號碼,使用標準的 E164 格式,e.g. +1778889901 ,多個手機號請使用半角逗號“,”分隔,如“+135xxxxxx,+447xxxxxx”。單次請求最大上限可提交 10000 個手機號碼 |
content | string | 必需 | 無 | 短信正文 |
tag | string | 可選 | 無 | 自定義標簽功能,該標簽可用作 SUBHOOK 追蹤 (32 個字符以內,添加了 tag 參數的 API 請求,會在所有的 SUBHOOK 事件中攜帶此參數。tag 參數不參加加密計算) |
timestamp | UNIX 時間戳 | 可選 | 無 | 參閱 API 授權與驗證機制 > Timestamp UNIX 時間戳 |
sign_type | string | 可選 | normal | API 授權模式( md5 or sha1 or normal )參閱 API 授權與驗證機制 > 授權和驗證方式 |
sign_version | string | 可選 | 無 | signature加密計算方式 (當sign_version傳2時,content參數不參與加密計算) |
signature | string | 必需 | 無 | 應用密匙或數字簽名 參閱 API授權與驗證機制 > 授權和驗證方式。當sign_type=normal時signature應傳appkey的值。 |
代碼示例
發(fā)送請求
request: curl -d "appid=***&signature=***&content=短信正文&to=+86186xxxxxx,+135xxxxxx,+447xxxxxx" https://api-v4.mysubmail.com/internationalsms/batchsend
響應
{
"status": "success", //請求狀態(tài)
"batchlist": "***", //任務ID
"total_fee": 0.38, //總計費
"responses": [
{
"status": "success", //單號狀態(tài)
"to": "+1352xxxxx", //號碼
"send_id": "007cb85168d1450e7aca462462ef12b8", //單號 SEND ID
"fee": 0.08 //單號計費條數
},
{
"status": "error", // 單號狀態(tài) 為 error 時提交失敗 (無效號碼,屏蔽區(qū)域,賬戶黑名單等原因)
"to": "+861xxx",
"fee": 0
},
{
"status": "success",
"to": "+447xxxxxx",
"send_id": "de4e69f475d24aad62948ac601e1c0ac",
"fee": 0.30
}
]
}
請求失敗
{
"status":"error",
"code":"1xx",
"msg":"error message"
}
錯誤代碼
參閱 API 錯誤代碼