联系我们  13266631104
说明文档
切换说明
推送目标服务配置说明

云开发--消息转发配置--推送目标配置


  • 配置说明
字段值描述
消息推送地址需要您搭建的服务的外网地址
状态应用:启用消息推送处理,不应用:不进行消息推送处理
类型直接token模式oauth2.0的credentials模式oauth2.0的password模式



  • 直接token模式

直接通过固定的token发送推送请求

字段值描述
请求Token请求您服务时的token,该token会设置到header的Authorization中


  • 消息推送的请求示例:

Request Headers

Content-Type: application/json; charset=UTF-8
Authorization: token

Request Body

Request Body即消息推送内容,说明查看:可推送的消息内容

{
    "id": "xxx",
    "type": "device_offline",
    "appid": "xxx",
    "payload": {
        "deviceSn": "xxx",
        "parentDeviceSn": null,
        "offline": 0
    },
    "timestamp": 1610431327806
}

Response Body

推送成功后,您需要返回的数据内容

{
    "status": 0,    //0:成功,非0:失败
    "description": "成功"   //响应描述
}




  • oauth2.0的client credentials模式

token通过oauth2.0的client credentials模式下获取后,再发送推送请求

字段值描述
Token地址支持oauth2.0的credentials模式的授权服务地址
Token有效时限(秒)从授权服务获取到的token的有效时限
OauthClientoauth2.0的client_id
OauthSecretoauth2.0的secret
OauthScopeoauth2.0的scope


  • client credentials模式下获取token的请求示例:

Request Headers

Content-Type: application/x-www-form-urlencoded
Authorization: "Authorization","Basic " + base64Encode(client_id:secret)

Request Body

grant_type=client_credentials&scope=xxx

Response Body

授权成功后,您需要返回的数据内容

{
    "access_token": "xxx",  //消息推送请求时使用的token
    "token_type": "bearer", //token的类型
    "expires_in": 86399,
    "scope": "xxx"
}


  • 消息推送的请求示例:

Request Headers

Content-Type: application/json; charset=UTF-8
Authorization: "bearer " + access_token

Request Body

Request Body即消息推送内容,说明查看:可推送的消息内容

{
    "id": "xxx",
    "type": "device_offline",
    "appid": "xxx",
    "payload": {
        "deviceSn": "xxx",
        "parentDeviceSn": null,
        "offline": 0
    },
    "timestamp": 1610431327806
}

Response Body

推送成功后,您需要返回的数据内容

{
    "status": 0,    //0:成功,非0:失败
    "description": "成功"   //响应描述
}




  • oauth2.0的password模式

token通过oauth2.0的password模式下获取后,再发送推送请求

字段值描述
Token地址支持oauth2.0的password模式的授权服务地址
Token有效时限(秒)从授权服务获取到的token的有效时限
OauthClientoauth2.0的client_id
OauthSecretoauth2.0的secret
OauthScopeoauth2.0的scope
账号oauth2.0的password模式下的username
密码oauth2.0的password模式下的password


  • password模式下获取token的请求示例:

Request Headers

Content-Type: application/x-www-form-urlencoded
Authorization: "Authorization","Basic " + base64Encode(client_id:secret)

Request Body

grant_type=password&username=xxx&password=base64Encode(xxx)&scope=xxx

Response Body

授权成功后,您需要返回的数据内容

{
    "access_token": "xxx",  //消息推送请求时使用的token
    "token_type": "bearer", //token的类型
    "expires_in": 86399,
    "scope": "xxx"
}


  • 消息推送的请求示例:

Request Headers

Content-Type: application/json; charset=UTF-8
Authorization: "bearer " + access_token

Request Body

Request Body即消息推送内容,说明查看:可推送的消息内容

{
    "id": "xxx",
    "type": "device_offline",
    "appid": "xxx",
    "payload": {
        "deviceSn": "xxx",
        "parentDeviceSn": null,
        "offline": 0
    },
    "timestamp": 1610431327806
}

Response Body

推送成功后,您需要返回的数据内容

{
    "status": 0,    //0:成功,非0:失败
    "description": "成功"   //状态描述
}


了解更多,免费体验,立即预约演示

联系电话:13266631104
预约演示

飞思未来(深圳)科技有限公司

飞思公众号 飞思公众号
Copyright ◎ 2019 飞思未来(深圳)科技有限公司 All right reserved.备案号:粤ICP备17047092号 技术支持:易百讯 - 深圳网站建设
联系电话
13266631104
关注我们
备案号:粤ICP备17047092号
技术支持:易百讯 - 深圳网站建设
Copyright ◎ 2019 飞思未来(深圳)科技有限公司 All right reserved.
微信咨询
 
 
 

留下您的联系方式

我们将安排专业人员为您服务
×