接口说明

url校验接口同推送消息接口是同一个接口(url相同,参数不同)。AppInterface接口处理流程如下:

a).clientServer收到http请求,用秘钥EncodingKey调用函数aesDecrypt对接收的“字节流”解密。
b).解析获取到身份验证所需的signature、timestamp、random,用“授权码”token调用函数genSignature产生一个signature字符进行比较,相同则验证通过。
c).处理消息。
d).生成一个random,根据服务器的timestamp,“授权码”token调用函数genSignature生成一个signature串。
e).根据接口说明生成json,结合秘钥EncodingKey调用函数aedEncrypt生成加密的字节流,在http请求的响应中输出密文。

url校验接口

客户在管理端配置消息的接收URL时,管理端要提供校验该URL、授权码、秘钥EncodingKey的“操作入口”。只有校验通过后,才可以保存配置的“消息推送接口及密钥”信息。 客户在管理端生成“授权码”、“秘钥”后,要将其拷贝到对应的URL程序中,并保证该URL可调用,以方便“校验”。

Https请求方式: POST

请求参数

{
    "signature":"sdfgwertwertwrwesdfg2345235234sdfg34534",   
    "timestamp":1439961959012,    
    "random": "testTasdfasdfasdfasdfasdfitle"         
}
参数名称 类型 可选 说明
signature String 必填 签名
timestamp long(64) 必填 时间戳(1970年1月1日 00:00:00 GMT以来的毫秒数)
random String 必填 128位的UUID 通用唯一识别码

返回结果

{
    "errorCode":0,
    "errorMessage":"successful!",
    "signature":"dfghrtyujh4573456tyjfghjtryu5367356345sdfg",
    "timestamp":1439961959012,
    "random": "testTasdfasdfasdfasdfasdfitle"
}
参数名称 类型 可选 说明
errorCode int 必填 0表示成功
errorMessage String 选填 执行结果信息
signature String 必填 AppInterface端生成的签名
timestamp long(64) 必填 AppInterface生成签名的时间戳(1970年1月1日 00:00:00 GMT以来的毫秒数)
random String 必填 AppInterface生成签名的uuid字符串

推送消息接口

AppPush向AppInterface接口推送的消息

Https请求方式: POST

请求参数

{
    "signature":"sdfgwertwertwrwesdfg2345235234sdfg34534",   
    "timestamp":1439961959012,    
    "random":"testTasdfasdfasdfasdfasdfitle",       
    "type":"message",
    "message":{
        "sender":"red_test10@quanshi.com",   
        "sendTime":"2015-08-10 14:07:36", 
        "msgType":"text/image/file",
        "image":{
            "mediaId":"asdfq345232352345",
            "filesize":212334545634
        },  
        "file":{
            "mediaId" : "asdfq345232352345",
            "filesize":212334545634
        },
        "text":{
            "content": "aaaaaaaaaa555"
        }         
        "msgCode":"ert3245wefsdfasfda"
    }
}
参数名称 类型 可选 说明
signature String 必填 签名
timestamp long(64) 必填 时间戳(1970年1月1日 00:00:00 GMT以来的毫秒数)
random String 必填 128位的UUID 通用唯一识别码
type String 必填 推送消息类型
message.sender String 必填 消息发送者账号
message.sendTime String 必填 发送时间
message.msgType String 必填 消息内容类型:text/image/file
message.image.mediaId String 选填 msgType为text时为null,图片ID
message.image.filesize String 选填 文件大小,单位字节
message.file.mediaId String 选填 msgType为text时为null,文件ID
message.file.filesize long(64) 选填 文件大小,单位字节
message.text.content String 选填 msgType为文本时必填
message.msgCode String 必填 消息唯一代码,可以用来排重

返回结果

{
    "errorCode":0,
    "errorMessage":"successful",
    "signature":"dfghrtyujh4573456tyjfghjtryu5367356345sdfg",
    "timestamp":1439961959012,
    "random": "testTasdfasdfasdfasdfasdfitle",
    "message":{
        "type":"text",
        "text":{
            "title":"消息标题",
            "content":"消息内容",
            "detailType":0, 0:文本,1:URL;
            "detailContent":"消息详情内容"
        }
    }
}
参数名称 类型 可选 说明
errorCode int 必填 0表示成功
errorMessage String 选填 执行结果信息
signature String 必填 AppInterface端生成的签名
timestamp long(64) 必填 AppInterface生成签名的时间戳(1970年1月1日 00:00:00 GMT以来的毫秒数)
random String 必填 AppInterface生成签名的uuid字符串
message json对象 选填 如果有答复消息,则必须填,目前支持text(文本)
message.type String 选填 回复消息类型:text
message.text.title String 选填 消息标题
message.text.content String 选填 消息内容
message.text.detailType int 选填 消息详情内容格式 0:文本,1:URL;
message.text.detailContent String 选填 消息详情, 如果是URL,客户端直接打开这个URL