1. hapia接口说明

1.1. 文档说明

信使服务提供了发送邮件、发送短信、APP推送、微信公众号推送的能力

1.2. 修订记录

日期 文档版本 修订内容 修改人
2020-09-18 v0.1 新建文档模板 Ken
2020-10-16 v1.0 初版信使接口文档 zhang

1.3. 接口约定

规则 描述
服务器域名(IP) 以部署为准,如: https://xxx.mixiot.top
接口鉴权 令牌机制,详情请阅接口鉴权
字符编码 统一采用UTF-8编码
响应格式 统一采用JSON格式

1.4. 响应说明

1.4.1. 返回码

code 含义 备注
200 请求成功 Code不为200,则说明请求失败
500 请求错误 -

1.4.2. 格式

1.单条记录

{
    "code":200,
    "msg":"success",
    "info":"",
    "result":{}
}

2.多条记录

{
    "code":200,
    "msg":"success",
    "info":"",
    "result":{
        "page_index":1,
        "page_size":20,
        "total_pages":0,
        "total_records":0,
        "data":[]
    }
}

1.5. 接口详细

1.5.1. Email(发送邮件)

请求地址:

属性
URL /api/send/send-email
Method post
Content-Type multipart/form-data

请求参数:

参数名称 是否必选 数据类型 数据约束 示例数据 描述
project_id int 非空整形 1 block_project_messenger的主键id
email_group json EmailSubject:不为空
EmailContent:不为空
EmailFile:可为空
{"EmailSubject":"邮件主题","EmailContent":"邮件文本","EmailFile":"邮件附件"} EmailSubject:邮件主题
EmailContent:邮件文本
EmailFile:邮件附件
send_user_group json - ["960647378@qq.com","3101979201@qq.com"] 收件人邮箱列表
object_id int 非空整形 1001 对象id

响应参数:

参数名称 数据类型 描述
code int 返回码
msg string 提示消息
mix_code string mixiot返回码
mix_ext string mixiot返回扩展
mix_msg string mixiot返回信息
result object 返回结果
+ class_id int 类型id
+ project_id int 项目id
+ object_id int 对象id
+ value json 请求与响应的集合
+ created string 创建时间
+ is_available int 是否可用
+ id int result的主键id

请求示例

curl -H "Content-Type: multipart/form-data" -X POST -F 'data={"project_id": 1, "email_group":{"EmailSubject":"邮件主题","EmailContent":"邮件文本","EmailFile":""},"send_user_group":["960647378@qq.com","3101979201@qq.com"],"object_id":1001}' "https://xxx.mixiot.top/api/send/send-email"

返回示例:

{
    "code": 200,
    "msg": "success",
    "mix_code": 130001,
    "mix_ext": "",
    "mix_msg": "",
    "result": {
        "class_id": "Email",
        "project_id": 1,
        "object_id": "1001",
        "value": {
            "request": {
                "project_id": "1",
                "email_group": "{\"EmailSubject\":\"邮件主题\",\"EmailContent\":\"邮件文本\",\"EmailFile\":\"\"}",
                "send_user_group": "[\"10001@qq.com\",\"10001@qq.com\"]",
                "object_id": "1001"
            },
            "response": [
                "QsVGKerfVcFzkot8NOGnf2P1chBb2VXd"
            ]
        },
        "created": "2020-10-16T08:06:40.844280Z",
        "is_available": 1,
        "id": 48
    }
}

1.5.2. SMS(发送短信)

请求地址:

属性
URL /api/send/send-sms
Method post
Content-Type multipart/form-data

请求参数:

参数名称 是否必选 数据类型 数据约束 示例数据 描述
project_id int 非空整形 1 block_project_messenger的主键id
sms_group json 华为短信服务
msgdata:必填
阿里短信服务
equipment_id:必填
equipment_name:必填
datetime:必填
msgdata:必填
华为 {"msgdata":"自定义内容"}
阿里 {"equipment_id":"1001","equipment_name":"测试设备","datetime":"2020-10-10 11:00:01","msgdata":"发生报警"}
发送消息体
send_user_group json - ["18102025228","18525541820"] 收件人手机号列表
object_id int 非空整形 1001 对象id

响应参数:

参数名称 数据类型 描述
code int 返回码
msg string 提示消息
mix_code string mixiot返回码
mix_ext string mixiot返回扩展
mix_msg string mixiot返回信息
result object 返回结果

请求示例

curl -H "Content-Type: multipart/form-data" -X POST -F 'data={"project_id": 2, "sms_group":{"msgdata":"自定义内容"},"send_user_group":["18102025228","18525541820"],"object_id":1001}' "https://xxx.mixiot.top/api/send/send-sms"

返回示例:

{
    "code": 200,
    "msg": "success",
    "mix_code": 130001,
    "mix_ext": "",
    "mix_msg": "",
    "result": ""
}

1.5.3. APP(app推送)

请求地址:

属性
URL /api/send/send-app-push
Method post
Content-Type multipart/form-data

请求参数:

参数名称 是否必选 数据类型 数据约束 示例数据 描述
project_id int 非空整形 1 block_project_messenger的主键id
android_msg_group json 全部属性必带,可写空值 {"Body":{"Ticker":"测试提示文字","Title":"通知标题","Text":"通知内容","Remark":"通知内容"},"AfterOpen":"go_app","Url":"","DesText":"xxxx"} Body:安卓的标准消息体
Ticker:提示文字
Title:通知标题
Text:通知文本
Remark:通知文本,可同Text
AfterOpen:打开通知后做什么,默认都是go_app
Url:如果打开去网页的话,可以填网址,打开app则为空
DesText:推送描述
send_android_user_group json - ["AtWtS8MdPjo8jNe1OdDK97_.."] 安卓用户的deviceToken的集合
ios_msg_group json 全部属性必带,可写空值 {"APS":{"AlertTitle":"通知标题","AlertSubtitle":"通知子标题","AlertBody":"通知文字描述"},"Extra":{"id":"1","type":"alert"},"DesText":"xxxx"} APS:IOS的标准消息体
AlertTitle:通知标题
AlertSubtitle:通知子标题
AlertBody:通知文字描述
Extra:扩展自定义字段
DesText:推送描述
send_ios_user_group json - [] ios用户的deviceToken的集合
id int 非空整形 54145 打开app传递的参数,用于安卓
type string - alert 默认为alert类型

响应参数:

参数名称 数据类型 描述
code int 返回码
msg string 提示消息
mix_code string mixiot返回码
mix_ext string mixiot返回扩展
mix_msg string mixiot返回信息
result object 返回结果

请求示例

curl -H "Content-Type: multipart/form-data" -X POST -F 'data={"project_id": 3, "android_msg_group":{"Body":{"Ticker":"测试提示文字2","Title":"通知标题","Text":"通知内容2","Remark":"通知内容32"},"AfterOpen":"go_app","Url":"","DesText":"xxxx"},"send_android_user_group":["AmoD88xCqmxUq1cL_5U0UtqrzcZcHMouknABykIYzQ0L"],"ios_msg_group":{"APS":{"AlertTitle":"通知标题","AlertSubtitle":"通知子标题","AlertBody":"通知文字描述"},"Extra":{"id":"1","type":"alert"},"DesText":"xxxx"},"send_ios_user_group":[],"id":1,"type":"alert","object_id":1001}' "https://xxx.mixiot.top/api/send/send-sms"

返回示例:

{
    "code": 200,
    "msg": "success",
    "mix_code": 130001,
    "mix_ext": "",
    "mix_msg": "",
    "result": ""
}

1.5.4. Wechat(发送公众号通知)

请求地址:

属性
URL /api/send/send-wechat
Method post
Content-Type multipart/form-data

请求参数:

参数名称 是否必选 数据类型 数据约束 示例数据 描述
project_id int 非空整形 1 block_project_messenger的主键id
object_id int 非空整形 1001 对象id
open_ids json - ["ogUt6wFfrBiui1zihcJNnGCmohrY"] 被推送人的微信openid列表
data_msg json 根据选择的模板设置对应的kv {"first":{"value":"对应first","color":"#173177"},"keyword1":{"value":"对应keyword1","color":"#173177"},"keyword2":{"value":"对应keyword2","color":"#173177"},↵ "keyword3":{"value":"对应keyword3","color":"#173177"},"keyword4":{"value":"对应keyword4", "color":"#173177"},"remark":{"value":"对应remark","color":"#173177"}} 需要发送的消息体

响应参数:

参数名称 数据类型 描述
code int 返回码
msg string 提示消息
mix_code string mixiot返回码
mix_ext string mixiot返回扩展
mix_msg string mixiot返回信息
result object 返回结果

请求示例

curl -H "Content-Type: multipart/form-data" -X POST -F 'data={"project_id": 4, "data_msg":{"first":{"value":"对应first","color":"#173177"},"keyword1":{"value":"对应keyword1","color":"#173177"},"keyword2":{"value":"对应keyword2","color":"#173177"},↵    "keyword3":{"value":"对应keyword3","color":"#173177"},"keyword4":{"value":"对应keyword4", "color":"#173177"},"remark":{"value":"对应remark","color":"#173177"}},"open_ids":["ogUt6wFfrBiui..."],"object_id":1001}' "https://xxx.mixiot.top/api/send/send-sms"

返回示例:

{
    "code": 200,
    "msg": "success",
    "mix_code": 130001,
    "mix_ext": "",
    "mix_msg": "",
    "result": ""
}
© Mixlinker all right reserved,powered by Gitbook文件修订时间: 2021-03-05 16:09:24

results matching ""

    No results matching ""