接入说明
引言
渠道方通过珞瑾提供的supplierId 和key 进行ota的接口交互。
接入条件
- 珞瑾合作机构
- 申领渠道方supplierId 和验签用的key
- 渠道方提供自己的url地址 供接口交互使用
数据交互规范
- 使用HTTP协议进行数据通信
- 使用POST方式发送请求
- 需要在HTTP的head中 增加
signature
与timestamp
以及supplierId
接口返回数据规范
服务端返回的数据总是包含code 和message字段 根据需要包含result字段
当渠道方调用珞瑾的时候,接口调用成功 code为0
当珞瑾调用渠道方当时候 code成功应该返回200
环境
验签
- 所有接口通信都需要在http header 中需要带上签名signature与timestamp和supplierId
- 所有接口都需要带有公共请求参数supplierId 为分配到渠道方
java示例如下
String timestamp = String.valueOf(System.currentTimeMillis());
String tmp = supplierId + timestamp + key; //supplierId和key会分配 取分配的真实的数据
MessageDigest md5 = MessageDigest.getInstance("MD5");
String signature = Base64.getEncoder().encodeToString(md5.digest(tmp.getBytes(StandardCharsets.UTF_8))).toUpperCase();
HashMap<String, String> headerMap = Maps.newHashMap();
headerMap.put("timestamp", timestamp);
headerMap.put("signature", signature);
headerMap.put("supplierId", supplierId);