关于前端:MobPush-创建推送

36次阅读

共计 4096 个字符,预计需要花费 11 分钟才能阅读完成。

性能阐明

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 和别名对应不同的推送内容,详情点击查看

返回码

正文完
 0