功能说明
MobPush提供遵循REST规范的HTTP接口,适用各开发语言环境调用。
IP绑定
工作台可以绑定服务器IP地址,未绑定之前所有IP均可进行REST API的调用,绑定后进仅绑定的IP才有调用权限。
调用地址
POSThttp://api.push.mob.com/v3/pu...
请求头
推送对象
以 JSON 格式表达,表示一条推送相关的所有信息。
pushTarget:推送目标
pushAreas:复杂地理位置
countries:国家列表
provinces:省份列表
pushNotify:推送展示细节配置
androidNotify:Android通知消息对象
customStyle:安卓通知自定义样式
iosNotify:iOS通知消息对象
pushOperator:运营保障相关配置
pushForward:Link 相关打开配置
pushCallback:推送回调配置
pushFactoryExtra:厂商特殊配置
huaweiExtra:华为厂商特殊配置
xiaomiExtra:小米厂商特殊配置
oppoExtra:OPPO厂商特殊配置
vivoExtra:VIVO厂商特殊配置
userExtra:用户补充信息
加密示例
参数
{"source":"webapi","appkey":"2f2d7a68f8a40","pushTarget":{"target":1},"pushNotify":{"plats":[1],"content":"推送的内容","type":1}}9abee316611dd24f607feb9f2c496338
计算结果
sign -> eb276f35cf6480169b2d3e2e509db680
请求示例
curl --location --request POST 'http://api.push.mob.com/v3/pu...' \
--header 'Content-Type: application/json' \
--header 'key: 2f2d7a68f8a40' \
--header 'sign: eb276f35cf6480169b2d3e2e509db680' \
--data-raw '{"source":"webapi","appkey":"2f2d7a68f8a40","pushTarget":{"target":1},"pushNotify":{"plats":[1],"content":"推送的内容","type":1}}'
响应示例
请求成功
{
"status": 200,
"res": {
"batchId": "4bp4tw9ttc06xgch6o",
"fetched": null,
"uninstalls": null,
"closes": null,
"notFounds": null
},
"error": null
}
请求失败
{
"status": 5801,
"res": null,
"error": "数据校验失败"
}
响应参数
调用示例
推送广播
{
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送的内容",
"type": 1
}
}
推送广播并附加参数
{
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1,
2
],
"content": "推送的内容",
"type": 1,
"iosProduction": 0,
"extrasMapList": [
{
"key": "ContentTypeasd",
"value": "personal_chat"
}
]
}
}
推送标签
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 3,
"tags": [
"男",
"上海",
"老师"
]
},
"pushNotify": {
"plats": [
1
],
"content": "推送的内容",
"type": 1
}
}
推送别名
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 2,
"alias": [
"alias_1",
"alias_2"
]
},
"pushNotify": {
"plats": [
1
],
"content": "推送的内容",
"type": 1
}
}
推送RegisterID
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 4,
"rids": [
"c262bac10d05ec1c9b04126d"
]
},
"pushNotify": {
"plats": [
1
],
"content": "推送的内容",
"type": 1
}
}
自定义消息(透传消息)
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 2,
"customNotify": {
"customType": "text 文本消息",
"customTitle": "自定义类型标题"
}
}
}
Android通知大图模式
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 1,
"androidNotify": {
"content": [
"Android推送内容1",
"Android推送内容2"
],
"style": 2
}
}
}
Android通知横幅模式
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 1,
"androidNotify": {
"content": [
"Android推送内容1",
"Android推送内容2"
],
"style": 3
}
}
}
Android通知自定义声音
音频文件放到项目res/raw目录下,只需传音频文件的文件名
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 1,
"androidNotify": {
"content": [
"Android推送内容1",
"Android推送内容2"
],
"style": 2,
"warn": "1",
"sound": "warn"
}
}
}
跳转首页并传递附加参数
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 1,
"androidNotify": {
"content": [
"Android推送内容1",
"Android推送内容2"
],
"style": 2,
"warn": "1",
"sound": "warn"
},
"extrasMapList": [
{
"key": "extrakey",
"value": "extravalue"
}
]
},
"pushForward": {
"nextType": 0
}
}
跳转到指定界面并且传递携带scheme数据
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 1,
"androidNotify": {
"content": [
"Android推送内容1",
"Android推送内容2"
],
"style": 2,
"warn": "1",
"sound": "warn"
}
},
"pushForward": {
"nextType": 2,
"scheme": "mlink://com.mob.mobpush.linkone",
"schemeDataList": [
{
"key": "schemekey",
"value": "schemevalue"
}
]
}
}
打开网页
{
"source": "webapi",
"appkey": "moba6b6c6d6",
"pushTarget": {
"target": 1
},
"pushNotify": {
"plats": [
1
],
"content": "推送内容",
"type": 1,
"androidNotify": {
"content": [
"Android推送内容1",
"Android推送内容2"
],
"style": 2,
"warn": "1",
"sound": "warn"
}
},
"pushForward": {
"nextType": 1,
"url": "http://www.mob.com"
}
}
频率限制
API频率控制
每个AppKey在每分钟的访问请求次数有如下限制:
推送接口的接口频率限制,默认500次/分钟;
查询接口的接口频率限制,默认300次/分钟;
注:如有更高需求,可联系商务或技术支持调整相关接口频率限制。
消息推送条数限制
单推(Rid推送或者别名推送):没有限制; 群体推送(智能标签推送):没有限制; 全部人群(广播):100次/天,每分钟1次; 注:如有更高需求,可联系商务或技术支持调整相关接口频率限制。
批量推送
MobPush还额外提供了批量推送接口,可以设置推送不同的regid和别名对应不同的推送内容,详情点击查看
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。