请求结构

更新时间: 2022/07/08 07:23:13

服务地址

网易云信互动白板服务使用的域名访问地址为:vcloud.163.com。

通信协议

所有接口均通过HTTPS进行通信,提供高安全性的通信通道。

获取上传加速节点和断点续传查询断点接口除外,只支持HTTP通信。

请求方法

所有接口都只支持POST请求。

获取上传加速节点和断点续传查询断点接口除外,为GET请求。

字符编码

所有接口均使用UTF-8编码。

公共参数

所有接口均需要放置以下公共参数在请求头中,用于标识用户和接口鉴权。后续的接口说明不再对这些参数进行说明,但每次发起请求均需要携带。

参数 类型 必须 说明
AppKey String 开发者平台分配的AppKey
Nonce String 随机数(随机数,最大长度128个字符)
CurTime String 当前UTC时间戳,从1970年1月1日0点0分0秒开始到现在的秒数
CheckSum String 服务器认证需要,SHA1(AppSecret+Nonce+CurTime),16进制字符小写

获取上传加速节点、文件数据上传、断点续传查询断点三个接口,不使用上述公共参数。

接口鉴权

接口通过请求头中的公共参数进行鉴权。登录网易云信控制台,点击应用名称 > 右侧App Key管理,即可查看AppKey和AppSecret,通过该安全凭证进行SHA1(AppSecret+Nonce+CurTime)计算。

本文档中提供的所有接口均面向开发者服务器端调用,用于计算CheckSum的AppSecret开发者应妥善保管,可在应用的服务器端存储和使用,但不应存储或传递到客户端,也不应在网页等前端代码中嵌入。

计算CheckSum的java代码举例如下:


    import java.security.MessageDigest;
    public class CheckSumBuilder {
        public static String getCheckSum(String appSecret, String nonce, String curTime) {
            return encode("sha1", appSecret + nonce + curTime);
        }
        private static String encode(String algorithm, String value) {
            if (value == null) {
                return null;
            }
            try {
                MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
                messageDigest.update(value.getBytes());
                return getFormattedText(messageDigest.digest());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } 
        private static String getFormattedText(byte[] bytes) {
            int len = bytes.length;
            StringBuilder buf = new StringBuilder(len * 2);
            for (int j = 0; j < len; j++) {
                buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
                buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
            }
            return buf.toString();
        }
        private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
    }
此文档是否对你有帮助?
有帮助
去反馈
  • 服务地址
  • 通信协议
  • 请求方法
  • 字符编码
  • 公共参数
  • 接口鉴权