短信定时发送 API
最近更新:2021-12-15
展开全部
短信定时发送 API
- 支持提交、修改、查询和删除模板短信定时发送任务
HTTP 验证
使用 HTTP Basic Authentication 的方式做访问授权。这样整个 API 请求可以使用常见的 HTTP 工具来完成,比如:curl,浏览器插件等;
HTTP Header(头)里加一个字段(Key/Value 对):
Authorization: Basic base64_auth_string
Authorization: Basic base64_auth_string
此代码块在浮窗中显示
其中 base64_auth_string 的生成算法为:base64(appKey:masterSecret),即:对 appKey 加上冒号,加上 masterSecret 拼装起来的字符串,再做 base64 转换。appKey、masterSecret 可以在【极光工作台】-【应用管理】-【设置&密钥】中查看。
单条定时短信提交 API
功能说明
- 提交单条模板短信定时发送任务
调用地址
请求示例
curl --insecure -X POST -v https://api.sms.jpush.cn/v1/schedule -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"mobile": "13812345678",
"sign_id": *,
"temp_id": 1250,
"temp_para": {
"number": "741627"
}
}'
curl --insecure -X POST -v https://api.sms.jpush.cn/v1/schedule -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"mobile": "13812345678",
"sign_id": *,
"temp_id": 1250,
"temp_para": {
"number": "741627"
}
}'
此代码块在浮窗中显示
参数
KEY | REQUIRE | DESCRIPTION |
---|---|---|
send_time | TRUE | 发送时间,格式为 yyyy-MM-dd HH:mm:ss |
mobile | TRUE | 手机号码 |
sign_id | FALSE | 签名 ID,该参数为空则使用应用默认签名,注意:签名审核通过后,可在控制台设为默认签名 |
temp_id | TRUE | 模板 ID |
temp_para | FALSE | 模板参数,需要替换的参数名和 value 的键值对 |
返回示例
请求成功
{ "schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e" }
{ "schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e" }
此代码块在浮窗中显示
请求失败
{
"error": {
"code": *****,
"message": "*****"
}
}
{
"error": {
"code": *****,
"message": "*****"
}
}
此代码块在浮窗中显示
批量定时短信提交 API
功能说明
- 提交批量模板短信定时发送任务
调用地址
请求示例
curl --insecure -X POST -v https://api.sms.jpush.cn/v1/schedule/batch -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"sign_id": *,
"temp_id": 1250,
"tag":"标签",
"recipients": [
{
"mobile": "13812345678",
"temp_para": {
"number": "741627"
}
},
{
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}'
curl --insecure -X POST -v https://api.sms.jpush.cn/v1/schedule/batch -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"sign_id": *,
"temp_id": 1250,
"tag":"标签",
"recipients": [
{
"mobile": "13812345678",
"temp_para": {
"number": "741627"
}
},
{
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}'
此代码块在浮窗中显示
参数
KEY | REQUIRE | DESCRIPTION |
---|---|---|
send_time | TRUE | 发送时间,格式为 yyyy-MM-dd HH:mm:ss |
sign_id | FALSE | 签名 ID,该参数为空则使用应用默认签名,注意:签名审核通过后,可在控制台设为默认签名 |
temp_id | TRUE | 模板 ID |
tag | FALSE | 标签,仅用作标示该短信的别名,不在短信中展示,最多不超过 10 个字 |
recipients | TRUE | 短信接收者列表 |
recipients.mobile | TRUE | 手机号码,上限 1000 个 |
recipients.temp_para | FALSE | 模板参数,需要替换的参数名和 value 的键值对 |
返回示例
请求成功
{
"schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e",
"success_count": 1,
"failure_count": 1,
"failure_recipients": [
{
"error_code": "50006",
"error_message": "invalid mobile",
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}
{
"schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e",
"success_count": 1,
"failure_count": 1,
"failure_recipients": [
{
"error_code": "50006",
"error_message": "invalid mobile",
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}
此代码块在浮窗中显示
请求失败
{
"error": {
"code": *****,
"message": "*****"
}
}
{
"error": {
"code": *****,
"message": "*****"
}
}
此代码块在浮窗中显示
单条定时短信修改 API
功能说明
- 修改单条模版短信定时发送任务
调用地址
请求示例
curl --insecure -X PUT -v https://api.sms.jpush.cn/v1/schedule/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"mobile": "13812345678",
"sign_id": *,
"temp_id": 1250,
"temp_para": {
"number": "741627"
}
}'
curl --insecure -X PUT -v https://api.sms.jpush.cn/v1/schedule/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"mobile": "13812345678",
"sign_id": *,
"temp_id": 1250,
"temp_para": {
"number": "741627"
}
}'
此代码块在浮窗中显示
参数
KEY | REQUIRE | DESCRIPTION |
---|---|---|
send_time | TRUE | 发送时间,格式为 yyyy-MM-dd HH:mm:ss |
mobile | TRUE | 手机号码 |
sign_id | FALSE | 签名 ID,该参数为空则使用应用默认签名,注意:签名审核通过后,可在控制台设为默认签名 |
temp_id | TRUE | 模板 ID |
temp_para | FALSE | 模板参数,需要替换的参数名和 value 的键值对 |
返回示例
请求成功
{ "schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e" }
{ "schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e" }
此代码块在浮窗中显示
请求失败
{
"error": {
"code": *****,
"message": "*****"
}
}
{
"error": {
"code": *****,
"message": "*****"
}
}
此代码块在浮窗中显示
批量定时短信修改 API
功能说明
- 修改批量模板短信定时发送任务
调用地址
请求示例
curl --insecure -X PUT -v https://api.sms.jpush.cn/v1/schedule/batch/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"sign_id": *,
"temp_id": 1250,
"recipients": [
{
"mobile": "13812345678",
"temp_para": {
"number": "741627"
}
},
{
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}'
curl --insecure -X PUT -v https://api.sms.jpush.cn/v1/schedule/batch/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d \
'{
"send_time": "2017-07-01 09:00:00",
"sign_id": *,
"temp_id": 1250,
"recipients": [
{
"mobile": "13812345678",
"temp_para": {
"number": "741627"
}
},
{
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}'
此代码块在浮窗中显示
参数
KEY | REQUIRE | DESCRIPTION |
---|---|---|
send_time | TRUE | 发送时间,格式为 yyyy-MM-dd HH:mm:ss |
sign_id | FALSE | 签名 ID,该参数为空则使用应用默认签名,注意:签名审核通过后,可在控制台设为默认签名 |
temp_id | TRUE | 模板 ID |
recipients | TRUE | 短信接收者列表 |
recipients.mobile | TRUE | 手机号码,上限 1000 个 |
recipients.temp_para | FALSE | 模板参数,需要替换的参数名和 value 的键值对 |
返回示例
请求成功
{
"schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e",
"success_count": 1,
"failure_count": 1,
"failure_recipients": [
{
"error_code": "50006",
"error_message": "invalid mobile",
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}
{
"schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e",
"success_count": 1,
"failure_count": 1,
"failure_recipients": [
{
"error_code": "50006",
"error_message": "invalid mobile",
"mobile": "18603050709",
"temp_para": {
"number": "147721"
}
}
]
}
此代码块在浮窗中显示
请求失败
{
"error": {
"code": *****,
"message": "*****"
}
}
{
"error": {
"code": *****,
"message": "*****"
}
}
此代码块在浮窗中显示
定时短信查询API
功能说明
- 查询模板短信定时发送任务
调用地址
请求示例
curl --insecure -X GET -v https://api.sms.jpush.cn/v1/schedule/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1"
curl --insecure -X GET -v https://api.sms.jpush.cn/v1/schedule/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1"
此代码块在浮窗中显示
返回示例
请求成功
{
"schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e",
"send_time": "2017-07-01 09:00:00",
"temp_id": 1250,
"recipients": [
{
"msg_id": "274887115920",
"mobile": "13812345678",
"temp_para": {
"number": "741627"
}
}
]
}
{
"schedule_id": "1a886e7c-a267-49e6-9970-0d396ca5bb1e",
"send_time": "2017-07-01 09:00:00",
"temp_id": 1250,
"recipients": [
{
"msg_id": "274887115920",
"mobile": "13812345678",
"temp_para": {
"number": "741627"
}
}
]
}
此代码块在浮窗中显示
请求失败
{
"error": {
"code": *****,
"message": "*****"
}
}
{
"error": {
"code": *****,
"message": "*****"
}
}
此代码块在浮窗中显示
定时短信删除 API
功能说明
- 删除模板短信定时发送任务
调用地址
请求示例
curl --insecure -X DELETE -v https://api.sms.jpush.cn/v1/schedule/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1"
curl --insecure -X DELETE -v https://api.sms.jpush.cn/v1/schedule/1a886e7c-a267-49e6-9970-0d396ca5bb1e -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1"
此代码块在浮窗中显示
返回示例
请求成功
HTTP/1.0 200
Content-Type: application/json
Content-Length: 0
HTTP/1.0 200
Content-Type: application/json
Content-Length: 0
此代码块在浮窗中显示
请求失败
{
"error": {
"code": *****,
"message": "*****"
}
}
{
"error": {
"code": *****,
"message": "*****"
}
}
此代码块在浮窗中显示
返回码
文档内容是否对您有帮助?