211 lines
16 KiB
Markdown
211 lines
16 KiB
Markdown
# Xiaomi
|
||
|
||
|
||
- [/notify.Xiaomi/Regid](#notifyxiaomiregid)
|
||
- [/notify.Xiaomi/Alias](#notifyxiaomialias)
|
||
- [/notify.Xiaomi/Topic](#notifyxiaomitopic)
|
||
- [/notify.Xiaomi/MultiTopic](#notifyxiaomimultitopic)
|
||
- [/notify.Xiaomi/All](#notifyxiaomiall)
|
||
|
||
## /notify.Xiaomi/Regid
|
||
|
||
向一组regid列表或alias列表推送单条消息(这些regId可以属于不同的包名)
|
||
|
||
|
||
### Request
|
||
```javascript
|
||
{
|
||
push_type: "", // type<string>, 推送类型:"alias";"registration_id"; 注:需要与push_id对应
|
||
push_id: [""], // list<string>, 根据alias或registration_id或account,发送消息到指定设备上,用逗号分割。
|
||
message: {
|
||
payload: "", // type<string>, 消息的内容。(注意:需要对payload字符串做urlencode处理)
|
||
restricted_package_name: "", // type<string>, App的包名。备注:中间用逗号分割。
|
||
title: "", // type<string>, 通知栏展示的通知的标题,不允许全是空白字符,长度小于50, 一个中英文字符均计算为1(通知栏消息必填)。
|
||
description: "", // type<string>, 通知栏展示的通知的描述,不允许全是空白字符,长度小于128,一个中英文字符均计算为1(通知栏消息必填)。
|
||
time_to_live: "0", // type<int64>, 可选项。如果用户离线,设置消息在服务器保存的时间,单位:ms。服务器默认最长保留两周。
|
||
time_to_send: "0", // type<int64>, 可选项。定时发送消息。用自1970年1月1日以来00:00:00.0 UTC时间表示(以毫秒为单位的时间)。注:仅支持七天内的定时消息。
|
||
sound_uri: "", // type<string>, 可选项,自定义通知栏消息铃声url
|
||
notify_foreground: "", // type<string>, 可选项 '1'弹出通知栏消息(默认);'0'不会弹出通知栏消息
|
||
notify_effect: "", // type<string>, 可选项,预定义通知栏消息的点击行为;"1":打开app的Launcher Activity。"2":打开app的任一Activity(需要extra.intent_uri)。"3":打开网页(需要传入extra.web_uri)
|
||
intent_uri: "", // type<string>, 可选项,打开当前app的任一组件。
|
||
web_uri: "", // type<string>, 可选项,打开某一个网页。
|
||
jobkey: "", // type<string>, 可选项,使用推送批次(JobKey)功能聚合消息。由数字([0-9]),大小写字母([a-zA-Z]),下划线(_)和中划线(-)组成,长度不大于20个字符
|
||
app_version: "", // type<string>, 可以接收消息的app版本号,用逗号分割。目前支持MiPush_SDK_Client_2_2_12_sdk.jar(及以后)的版本。
|
||
app_version_not_in: "", // type<string>, 无法接收消息的app版本号,用逗号分割。
|
||
connpt: "", // type<string>, 可选项,指定在特定的网络环境下才能接收到消息。目前仅支持指定"wifi"。
|
||
only_send_once: "", // type<string>, 可选项,extra.only_send_once的值设置为'1',表示该消息仅在设备在线时发送一次,不缓存离线消息进行多次下发
|
||
notify_id: 0, // type<int32>, 可选项。默认情况下,通知栏只显示一条推送消息。如果通知栏要显示多条推送消息,需要针对不同的消息设置不同的notify_id(相同notify_id的通知栏消息会覆盖之前的),且要求notify_id为取值在0~2147483647的整数。
|
||
}, // type<BaseItem>
|
||
}
|
||
```
|
||
|
||
### Reply
|
||
```javascript
|
||
{
|
||
status: "0", // type<int64>, 状态码
|
||
identity: "", // type<string>, 标识码
|
||
message: "", // type<string>, 状态说明
|
||
timeseq: "0", // type<int64>, 响应时间序列
|
||
}
|
||
```
|
||
## /notify.Xiaomi/Alias
|
||
|
||
向某个alias或一组alias列表推送某条消息(这些alias可以属于不同的包名)
|
||
|
||
|
||
### Request
|
||
```javascript
|
||
{
|
||
push_type: "", // type<string>, 推送类型:"alias";"registration_id"; 注:需要与push_id对应
|
||
push_id: [""], // list<string>, 根据alias或registration_id或account,发送消息到指定设备上,用逗号分割。
|
||
message: {
|
||
payload: "", // type<string>, 消息的内容。(注意:需要对payload字符串做urlencode处理)
|
||
restricted_package_name: "", // type<string>, App的包名。备注:中间用逗号分割。
|
||
title: "", // type<string>, 通知栏展示的通知的标题,不允许全是空白字符,长度小于50, 一个中英文字符均计算为1(通知栏消息必填)。
|
||
description: "", // type<string>, 通知栏展示的通知的描述,不允许全是空白字符,长度小于128,一个中英文字符均计算为1(通知栏消息必填)。
|
||
time_to_live: "0", // type<int64>, 可选项。如果用户离线,设置消息在服务器保存的时间,单位:ms。服务器默认最长保留两周。
|
||
time_to_send: "0", // type<int64>, 可选项。定时发送消息。用自1970年1月1日以来00:00:00.0 UTC时间表示(以毫秒为单位的时间)。注:仅支持七天内的定时消息。
|
||
sound_uri: "", // type<string>, 可选项,自定义通知栏消息铃声url
|
||
notify_foreground: "", // type<string>, 可选项 '1'弹出通知栏消息(默认);'0'不会弹出通知栏消息
|
||
notify_effect: "", // type<string>, 可选项,预定义通知栏消息的点击行为;"1":打开app的Launcher Activity。"2":打开app的任一Activity(需要extra.intent_uri)。"3":打开网页(需要传入extra.web_uri)
|
||
intent_uri: "", // type<string>, 可选项,打开当前app的任一组件。
|
||
web_uri: "", // type<string>, 可选项,打开某一个网页。
|
||
jobkey: "", // type<string>, 可选项,使用推送批次(JobKey)功能聚合消息。由数字([0-9]),大小写字母([a-zA-Z]),下划线(_)和中划线(-)组成,长度不大于20个字符
|
||
app_version: "", // type<string>, 可以接收消息的app版本号,用逗号分割。目前支持MiPush_SDK_Client_2_2_12_sdk.jar(及以后)的版本。
|
||
app_version_not_in: "", // type<string>, 无法接收消息的app版本号,用逗号分割。
|
||
connpt: "", // type<string>, 可选项,指定在特定的网络环境下才能接收到消息。目前仅支持指定"wifi"。
|
||
only_send_once: "", // type<string>, 可选项,extra.only_send_once的值设置为'1',表示该消息仅在设备在线时发送一次,不缓存离线消息进行多次下发
|
||
notify_id: 0, // type<int32>, 可选项。默认情况下,通知栏只显示一条推送消息。如果通知栏要显示多条推送消息,需要针对不同的消息设置不同的notify_id(相同notify_id的通知栏消息会覆盖之前的),且要求notify_id为取值在0~2147483647的整数。
|
||
}, // type<BaseItem>
|
||
}
|
||
```
|
||
|
||
### Reply
|
||
```javascript
|
||
{
|
||
status: "0", // type<int64>, 状态码
|
||
identity: "", // type<string>, 标识码
|
||
message: "", // type<string>, 状态说明
|
||
timeseq: "0", // type<int64>, 响应时间序列
|
||
}
|
||
```
|
||
## /notify.Xiaomi/Topic
|
||
|
||
向某个topic推送单条消息
|
||
|
||
|
||
### Request
|
||
```javascript
|
||
{
|
||
topic: "", // type<string>, 根据topic,发送消息给订阅了该topic的所有设备
|
||
message: {
|
||
payload: "", // type<string>, 消息的内容。(注意:需要对payload字符串做urlencode处理)
|
||
restricted_package_name: "", // type<string>, App的包名。备注:中间用逗号分割。
|
||
title: "", // type<string>, 通知栏展示的通知的标题,不允许全是空白字符,长度小于50, 一个中英文字符均计算为1(通知栏消息必填)。
|
||
description: "", // type<string>, 通知栏展示的通知的描述,不允许全是空白字符,长度小于128,一个中英文字符均计算为1(通知栏消息必填)。
|
||
time_to_live: "0", // type<int64>, 可选项。如果用户离线,设置消息在服务器保存的时间,单位:ms。服务器默认最长保留两周。
|
||
time_to_send: "0", // type<int64>, 可选项。定时发送消息。用自1970年1月1日以来00:00:00.0 UTC时间表示(以毫秒为单位的时间)。注:仅支持七天内的定时消息。
|
||
sound_uri: "", // type<string>, 可选项,自定义通知栏消息铃声url
|
||
notify_foreground: "", // type<string>, 可选项 '1'弹出通知栏消息(默认);'0'不会弹出通知栏消息
|
||
notify_effect: "", // type<string>, 可选项,预定义通知栏消息的点击行为;"1":打开app的Launcher Activity。"2":打开app的任一Activity(需要extra.intent_uri)。"3":打开网页(需要传入extra.web_uri)
|
||
intent_uri: "", // type<string>, 可选项,打开当前app的任一组件。
|
||
web_uri: "", // type<string>, 可选项,打开某一个网页。
|
||
jobkey: "", // type<string>, 可选项,使用推送批次(JobKey)功能聚合消息。由数字([0-9]),大小写字母([a-zA-Z]),下划线(_)和中划线(-)组成,长度不大于20个字符
|
||
app_version: "", // type<string>, 可以接收消息的app版本号,用逗号分割。目前支持MiPush_SDK_Client_2_2_12_sdk.jar(及以后)的版本。
|
||
app_version_not_in: "", // type<string>, 无法接收消息的app版本号,用逗号分割。
|
||
connpt: "", // type<string>, 可选项,指定在特定的网络环境下才能接收到消息。目前仅支持指定"wifi"。
|
||
only_send_once: "", // type<string>, 可选项,extra.only_send_once的值设置为'1',表示该消息仅在设备在线时发送一次,不缓存离线消息进行多次下发
|
||
notify_id: 0, // type<int32>, 可选项。默认情况下,通知栏只显示一条推送消息。如果通知栏要显示多条推送消息,需要针对不同的消息设置不同的notify_id(相同notify_id的通知栏消息会覆盖之前的),且要求notify_id为取值在0~2147483647的整数。
|
||
}, // type<BaseItem>
|
||
}
|
||
```
|
||
|
||
### Reply
|
||
```javascript
|
||
{
|
||
status: "0", // type<int64>, 状态码
|
||
identity: "", // type<string>, 标识码
|
||
message: "", // type<string>, 状态说明
|
||
timeseq: "0", // type<int64>, 响应时间序列
|
||
}
|
||
```
|
||
## /notify.Xiaomi/MultiTopic
|
||
|
||
向多个topic推送单条消息(可以指定一个或多个包名)
|
||
|
||
|
||
### Request
|
||
```javascript
|
||
{
|
||
topics: "", // type<string>, topic列表,使用;$;分割。注: topics参数需要和topic_op参数配合使用,另外topic的数量不能超过5。
|
||
topic_op: "", // type<string>, topic之间的操作关系。支持以下三种:UNION并集INTERSECTION交集EXCEPT差集例如:topics的列表元素是[A, B, C, D],则并集结果是A∪B∪C∪D,交集的结果是A ∩B ∩C ∩D,差集的结果是A-B-C-D。
|
||
message: {
|
||
payload: "", // type<string>, 消息的内容。(注意:需要对payload字符串做urlencode处理)
|
||
restricted_package_name: "", // type<string>, App的包名。备注:中间用逗号分割。
|
||
title: "", // type<string>, 通知栏展示的通知的标题,不允许全是空白字符,长度小于50, 一个中英文字符均计算为1(通知栏消息必填)。
|
||
description: "", // type<string>, 通知栏展示的通知的描述,不允许全是空白字符,长度小于128,一个中英文字符均计算为1(通知栏消息必填)。
|
||
time_to_live: "0", // type<int64>, 可选项。如果用户离线,设置消息在服务器保存的时间,单位:ms。服务器默认最长保留两周。
|
||
time_to_send: "0", // type<int64>, 可选项。定时发送消息。用自1970年1月1日以来00:00:00.0 UTC时间表示(以毫秒为单位的时间)。注:仅支持七天内的定时消息。
|
||
sound_uri: "", // type<string>, 可选项,自定义通知栏消息铃声url
|
||
notify_foreground: "", // type<string>, 可选项 '1'弹出通知栏消息(默认);'0'不会弹出通知栏消息
|
||
notify_effect: "", // type<string>, 可选项,预定义通知栏消息的点击行为;"1":打开app的Launcher Activity。"2":打开app的任一Activity(需要extra.intent_uri)。"3":打开网页(需要传入extra.web_uri)
|
||
intent_uri: "", // type<string>, 可选项,打开当前app的任一组件。
|
||
web_uri: "", // type<string>, 可选项,打开某一个网页。
|
||
jobkey: "", // type<string>, 可选项,使用推送批次(JobKey)功能聚合消息。由数字([0-9]),大小写字母([a-zA-Z]),下划线(_)和中划线(-)组成,长度不大于20个字符
|
||
app_version: "", // type<string>, 可以接收消息的app版本号,用逗号分割。目前支持MiPush_SDK_Client_2_2_12_sdk.jar(及以后)的版本。
|
||
app_version_not_in: "", // type<string>, 无法接收消息的app版本号,用逗号分割。
|
||
connpt: "", // type<string>, 可选项,指定在特定的网络环境下才能接收到消息。目前仅支持指定"wifi"。
|
||
only_send_once: "", // type<string>, 可选项,extra.only_send_once的值设置为'1',表示该消息仅在设备在线时发送一次,不缓存离线消息进行多次下发
|
||
notify_id: 0, // type<int32>, 可选项。默认情况下,通知栏只显示一条推送消息。如果通知栏要显示多条推送消息,需要针对不同的消息设置不同的notify_id(相同notify_id的通知栏消息会覆盖之前的),且要求notify_id为取值在0~2147483647的整数。
|
||
}, // type<BaseItem>
|
||
}
|
||
```
|
||
|
||
### Reply
|
||
```javascript
|
||
{
|
||
status: "0", // type<int64>, 状态码
|
||
identity: "", // type<string>, 标识码
|
||
message: "", // type<string>, 状态说明
|
||
timeseq: "0", // type<int64>, 响应时间序列
|
||
}
|
||
```
|
||
## /notify.Xiaomi/All
|
||
|
||
向所有设备推送某条消息(可以指定一个或多个包名)
|
||
|
||
|
||
### Request
|
||
```javascript
|
||
{
|
||
payload: "", // type<string>, 消息的内容。(注意:需要对payload字符串做urlencode处理)
|
||
restricted_package_name: "", // type<string>, App的包名。备注:中间用逗号分割。
|
||
title: "", // type<string>, 通知栏展示的通知的标题,不允许全是空白字符,长度小于50, 一个中英文字符均计算为1(通知栏消息必填)。
|
||
description: "", // type<string>, 通知栏展示的通知的描述,不允许全是空白字符,长度小于128,一个中英文字符均计算为1(通知栏消息必填)。
|
||
time_to_live: "0", // type<int64>, 可选项。如果用户离线,设置消息在服务器保存的时间,单位:ms。服务器默认最长保留两周。
|
||
time_to_send: "0", // type<int64>, 可选项。定时发送消息。用自1970年1月1日以来00:00:00.0 UTC时间表示(以毫秒为单位的时间)。注:仅支持七天内的定时消息。
|
||
sound_uri: "", // type<string>, 可选项,自定义通知栏消息铃声url
|
||
notify_foreground: "", // type<string>, 可选项 '1'弹出通知栏消息(默认);'0'不会弹出通知栏消息
|
||
notify_effect: "", // type<string>, 可选项,预定义通知栏消息的点击行为;"1":打开app的Launcher Activity。"2":打开app的任一Activity(需要extra.intent_uri)。"3":打开网页(需要传入extra.web_uri)
|
||
intent_uri: "", // type<string>, 可选项,打开当前app的任一组件。
|
||
web_uri: "", // type<string>, 可选项,打开某一个网页。
|
||
jobkey: "", // type<string>, 可选项,使用推送批次(JobKey)功能聚合消息。由数字([0-9]),大小写字母([a-zA-Z]),下划线(_)和中划线(-)组成,长度不大于20个字符
|
||
app_version: "", // type<string>, 可以接收消息的app版本号,用逗号分割。目前支持MiPush_SDK_Client_2_2_12_sdk.jar(及以后)的版本。
|
||
app_version_not_in: "", // type<string>, 无法接收消息的app版本号,用逗号分割。
|
||
connpt: "", // type<string>, 可选项,指定在特定的网络环境下才能接收到消息。目前仅支持指定"wifi"。
|
||
only_send_once: "", // type<string>, 可选项,extra.only_send_once的值设置为'1',表示该消息仅在设备在线时发送一次,不缓存离线消息进行多次下发
|
||
notify_id: 0, // type<int32>, 可选项。默认情况下,通知栏只显示一条推送消息。如果通知栏要显示多条推送消息,需要针对不同的消息设置不同的notify_id(相同notify_id的通知栏消息会覆盖之前的),且要求notify_id为取值在0~2147483647的整数。
|
||
}
|
||
```
|
||
|
||
### Reply
|
||
```javascript
|
||
{
|
||
status: "0", // type<int64>, 状态码
|
||
identity: "", // type<string>, 标识码
|
||
message: "", // type<string>, 状态说明
|
||
timeseq: "0", // type<int64>, 响应时间序列
|
||
}
|
||
```
|
||
|