云服务器内容精选

  • setLogLevel setLogLevel(level: string): boolean 【功能说明】 设置Console上打印的日志级别,如不设置日志级别,则console日志打印级别默认为error。 【请求参数】 level:string类型,必选,日志级别标识。 none:关闭全部级别的日志打印。 error:打印error级别日志。 warn:打印warn级别及更高级别日志。 info:打印info级别及更高级别日志。 debug:打印debug级别及更高级别日志。 【返回参数】 boolean:设置日志级别结果。true表示日志级别设置成功,false表示日志级别设置失败。
  • setReportConfig setReportConfig(reportConfig:ReportConfig):boolear 【功能说明】 设置打点能力以及打点和日志上传的认证策略。 【请求参数】 reportConfig:ReportConfig类型,必选。ReportConfig定义如下所示: enable:必选,布尔类型,true表示开启打点,false表示关闭打点。默认true。 tokenConfig:可选,对象定义如下所示: enable:布尔类型,true表示开启认证,false表示关闭认证。默认false。 tokenInfo:数组类型,数组内部ReportTokenInfo类。ReportTokenInfo定义如下所示: appid:string类型。传入appid。 expTimestamp:string类型。过期时间戳,系统当前UNIX时间戳加上鉴权过期时间(推荐7200秒,最长需要小于43200秒,即12个小时)。 例如:当前UNIX时间戳为:1708531200,鉴权过期时间自定义为7200秒,那么过期的时间戳为:1708538400,即表示该校验字符串在2024-02-22 02:00:00过期。 token:string类型。hmac_sha256生成的字符串。hmac_sha256(共享密钥, 过期的时间戳 + appID)。共享密钥由用户控制获取。 【返回参数】 返回值布尔值, true表示设置成功,false表示设置失败。 开启了认证策略,实际请求状态会通过on函数注册Error回调获得。
  • setParameter setParameter(parameterKey: string, parameterValue: any): boolean 【功能说明】 设置全局配置参数。 【请求参数】 参数名称 参数值 LOADING_CONFIG LoadingConfig类型,定义如下: { netQualityLoading:可选,boolean类型。true表示开启根据网络质量进行loading效果展示,默认值为false,关闭。 netQualityLoadingThreshold:可选,number类型。展示loading效果的网络质量(network-quality)的阈值,默认网络质量等级为5。 frameStuckLoading:可选,boolean类型。true表示开启根据帧卡顿时长进行loading效果展示,默认值为false frameStuckThreshold:可选,number类型。展示loading效果帧卡顿时长的阈值,单位为100ms。默认值为10,表示帧卡顿时长为1000ms。 } 注意: 需要在起播之前进行设置。 DNS_QUERY_ENABLE boolean类型,可选,默认为false,true表示开启DNS结果解析,false表示关闭DNS结果解析。 AC CES S_DOMAIN string类型,可选,默认为空,主要用于拉流环境配置,沟通华为工程师填入。 GLSB_DOMAIN string类型,可选,默认为空,主要用于GSLB环境配置,沟通华为工程师填入。 【返回参数】 boolean:配置参数设置结果。true表示参数设置成功,false表示参数设置失败。
  • createClient createClient(type: string): HWLLSClient | HWFlvClient | HWHlsClient 【功能说明】 创建一个直播拉流客户端对象,如果需要拉取多个直播流则需要创建多个客户端对象。 【请求参数】 type:string类型,可选。创建的拉流客户端类型。 低时延直播拉流客户端类型:webrtc。 flv直播拉流客户端类型:flv。 HLS直播拉流客户端类型:hls(预留,暂未开放)。 缺省值:webrtc。 【返回参数】 client:拉流客户端对象。
  • 请求消息示例 POST /v2/usg/acs/auth/appauth Connection: keep-alive Content-Type: application/json X-Request-ID: 5162fa32dc7e47afafeee39a72a2eec3 Accept-Language: zh-CN Host: api.meeting.huaweicloud.com X-Token-Type: LongTicket Authorization: HMAC-SHA256 signature=3eca3f0f1e90ed55de38388066d02f1b7a86571a8ce30823af1df7c4edd7e086,access=ZmRiOGU0Njk5NTg2NDU4YmJkMTBjODM0ODcyZGNjNjI= User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_191) { "appId": "fdb8e4699586458bbd10c834872dcc62", "clientType": 72, "expireTime": 1627722929, "nonce": "EycLQsHwxhzK9OW8UEKWNfH2I3CGR2nINuU1EBpv162d42d92s", "userEmail": "******", "userId": "testuser@mycorp.com", "userName": "testuser", "userPhone": "173****9092" }
  • CURL命令示例 curl -k -i -H 'content-type: application/json' -X POST -H 'Content-Type: application/json,Accept-Language: zh-CN,X-Token-Type: LongTicket,Authorization: HMAC-SHA256 signature=3eca3f0f1e90ed55de38388066d02f1b7a86571a8ce30823af1df7c4edd7e086,access=ZmRiOGU0Njk5NTg2NDU4YmJkMTBjODM0ODcyZGNjNjI=' -d '{"appId": "fdb8e4699586458bbd10c834872dcc62","clientType": 72,"corpId": "807074304","expireTime": 1597824907000,"nonce": "EycLQsHwxhzK9OW8UEKWNfH2I3CGR2nINuU1EBpQ","userEmail": "******","userId": "alice@ent01","userName": "alice","userPhone": "173****9092"}' 'https://api.meeting.huaweicloud.com/v2/usg/acs/auth/appauth'
  • 响应消息示例 HTTP/1.1 200 "X-Envoy-Upstream-Service-Time": "230", "Server": "api-gateway", "X-Request-Id": "085d1f96cd9ddd6f3c50d70a0b2eb239", "X-Content-Type-Options": "nosniff", "Connection": "keep-alive", "X-Download-Options": "noopen", "Pragma": "No-cache", "Date": "Sat, 31 Jul 2021 06:18:07 GMT", "X-Frame-Options": "SAMEORIGIN", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Cache-Control": "no-cache", "X-Xss-Protection": "1; mode=block", "Content-Security-Policy": "connect-src 'self' *.huaweicloud.com ;style-src 'self' 'unsafe-inline' 'unsafe-eval';object-src 'self'; font-src 'self' data:;", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Content-Length": "1250", "Content-Type": "application/json" { "accessToken":"cnr1316vcp2ceIkbfko3z13Y2J8UdioOw0ER4kTK", "tokenIp":"49.4.112.60", "validPeriod":56326, "expireTime":1627768613, "createTime":1627712287360, "user":{ "realm":"huaweicloud.com", "userId":"53e2759d388e413abf6a56743a2694c5", "ucloginAccount":"Auto-53e2759d388e413abf6a56743a2694c5", "serviceAccount":"sip:+99111283523475338@huaweicloud.com", "numberHA1":"065eb94e5b090f70c77d4d1439f35b8e", "alias1":null, "companyId":"651543334", "spId":"8a8df0a174a1c6680174a26f578b0000", "companyDomain":null, "userType":2, "adminType":2, "name":"testuser@mycorp.com", "nameEn":"", "isBindPhone":null, "freeUser":false, "thirdAccount":"testuser@mycorp.com", "visionAccount":null, "headPictureUrl":null, "password":null, "status":0, "paidAccount":null, "paidPassword":null, "weLinkUser":false, "appId":"fdb8e4699586458bbd10c834872dcc62", "tr069Account":null, "corpType":5, "cloudUserId":"", "grayUser":true }, "clientType":72, "forceLoginInd":null, "firstLogin":false, "pwdExpired":false, "daysPwdAvailable":-19678, "proxyToken":null, "tokenType":0, "refreshToken":"cnr13168neNyRDfomYEIci7zVjBBybZQG90fYdX2", "refreshValidPeriod":2592000, "refreshExpireTime":1630304287, "refreshCreateTime":1627712287360 }
  • 请求参数 表2 参数说明 参数 是否必须 类型 位置 描述 Authorization 是 String Header 携带应用鉴权信息。 规则:HMAC-SHA256 signature=HexEncode(HMAC256((appId + ":" + userId + ":" + expireTime + ":" + nonce), appKey)),access=base64(appId) 样例:HMAC-SHA256 signature=07f31aa9eafb06652c6899248b145c1a3264242e2ccf4c81b1b6eb99bb5c,access=ZmRiOGU0Njk5NTg2NDU4YmJkMTBjODM0ODcyZGNjNjI= 说明: 如携带了userId信息,则Body中,也需填写对应的userId信息。 (必填)鉴权头域携带access内容为对应颁发应用id进行base64编码。 X-Token-Type 是 String Header Token类型设置为:LongTicket Content-Type 是 String Header Body的媒体格式。 样例:application/json; charset=UTF-8 X-Request-ID 否 String Header 请求requestId,用来标识一路请求,用于问题跟踪定位,建议使用UUID,若不携带,则后台自动生成。 Accept-Language 否 String Header 语言参数,默认为中文zh-CN,英文为en-US。 appId 是 String Body App ID。如何获取App ID请参考“App ID的申请”。 clientType 是 Integer Body 登录账号类型。 72:API调用类型 corpId 否 String Body 企业ID。 说明: 当SP应用场景携带,如果corpId和userId字段未携带或值为空字符串时,当作SP默认管理员登录。 仅在SP模式下需要填写,单企业模式不要填写,否则会鉴权失败。 expireTime 是 Long Body 应用鉴权信息过期时间戳,单位秒。 说明: 当收到App ID鉴权请求时服务端的Unix时间戳大于expireTime时,本次鉴权失败。 样例:如果要求App ID鉴权信息10分钟后过期,expireTime = 当前Unix时间戳 + 60*10。 如果要求应用鉴权信息始终不过期,expireTime = 0。 nonce 是 String Body 随机字符串,用于计算应用鉴权信息。 minLength:32 maxLength:64 userEmail 否 String Body email地址。 userId 否 String Body 第三方用户ID。 说明: 当userId字段未携带或值为空字符串时,当作企业默认管理员登录。 userName 否 String Body 用户名称。 userPhone 否 String Body 手机号,例如中国大陆手机+86xxxxxxx deptCode 否 String Body 部门编码。通过“查询部门及其一级子部门列表”接口获取。
  • 响应参数 表4 响应参数 参数 类型 描述 accessToken String Access Token字符串。 clientType Integer 登录账号类型。 72:API调用类型 createTime Long Access token的创建时间戳,单位:毫秒。 daysPwdAvailable Integer 密码有效天数。 delayDelete Boolean 是否延时删除状态。 expireTime Long Access Token的失效时间戳,单位:秒。 firstLogin Boolean 是否首次登录。 说明: 首次登录表示尚未修改过密码。首次登录时,系统会提醒用户需要修改密码。 默认值:false。 forceLoginInd Integer 抢占登录标识。 0:非抢占 1:抢占(未启用) proxyToken ProxyTokenDTO object 代理鉴权信息。 pwdExpired Boolean 密码是否过期。 默认值:false。 refreshCreateTime Long Refresh Token的创建时间戳,单位:毫秒。 refreshExpireTime Long Refresh Token的失效时间戳,单位:秒。 refreshToken String Refresh Token字符串。 refreshValidPeriod Long Refresh Token有效时长,单位:秒。 tokenIp String 用户IP。 tokenType Integer Token类型。 0:用户ACCESS TOKEN 1:会控TOKEN 2:一次性TOKEN user UserInfo object 用户鉴权信息。 validPeriod Long Access Token的有效时长,单位:秒。
  • 描述 该接口使用App ID方式进行鉴权,鉴权通过后生成一个Access Token。App ID鉴权的原理介绍,请参考App ID鉴权介绍。 当clientType取值为72时,同一个userId,同时最多能创建64个Token。比如已经创建了64个Token,并且Token都在有效期内,再用同一个userId创建一个Token,前64个Token中最早创建的Token将失效。 当clientType取值为非72时,同一个userId,同时最多能创建1个Token。 Token有效期是12~24小时。
  • 请求消息示例 GET /v1/mmc/management/record/downloadurls?confUUID=51adf610220411eaaae03f22d33cc26b Connection: keep-alive X-Access-Token: stbX5ElstO5QwOwPB9KGQWUZ1DHoFrTsQjjC user-agent: WeLink -desktop Host: api.meeting.huaweicloud.com User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_191)
  • 响应消息示例 HTTP/1.1 200 Date: Wed, 18 Dec 2019 06:20:40 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 505 Connection: keep-alive Expires: 0 Pragma: No-cache Cache-Control: no-cache http_proxy_id: 4556e88832e5990723d1712395f5bee8 Server: api-gateway X-Request-Id: 629891c82bb852d8796e2f6acc74721e { "recordUrls": [ { "confUuid": "ef67f6ada67e11eba6374db4b9a61d2c", "urls": [ { "token": "f8fe906eaa6d690ef72bc831df54ffd9fc906412aefd329ace96d100cf1bc4be", "fileType": "Aux", "url": "https://100.85.230.37/download/typeThree/video/resource/00037/00037ed2-351a-4741-8ce6-a2078f21ba6b/videoAux/0_0.mp4" }, { "token": "ad8a6f6e009d643ca21f8be306e9e2cadd726360236f07bd176c1b85423b7136", "fileType": "Hd", "url": "https://100.85.230.37/download/typeThree/video/resource/00037/00037ed2-351a-4741-8ce6-a2078f21ba6b/videoHD/0_0.mp4" }, { "token": "fe7a59c69e3f97e831c83d55193a061e5e33e019f4704e5eb441c7f1fa629ad2", "fileType": "Sd", "url": "https://100.85.230.37/download/typeThree/video/resource/00037/00037ed2-351a-4741-8ce6-a2078f21ba6b/videoSD/0_0.mp4" }, { "token": "38e6b3fe7f7c62dd2141a408f4f64b911d1b58a5e04a4f6e0cfd2602181a8ad3", "fileType": "Aux", "url": "https://100.85.230.37/download/typeThree/video/resource/00037/00037ed2-351a-4741-8ce6-a2078f21ba6b/videoAux/0_1.mp4" }, { "token": "843731642aba1ebb720195a7c44f3f1e32ab409d29b2ecd1c58f30ee269f6da6", "fileType": "Hd", "url": "https://100.85.230.37/download/typeThree/video/resource/00037/00037ed2-351a-4741-8ce6-a2078f21ba6b/videoHD/0_1.mp4" }, { "token": "9fd3471e9dc047c3c345308f0cbed005f227bf48aa47875c7fe752c5a817cbd9", "fileType": "Sd", "url": "https://100.85.230.37/download/typeThree/video/resource/00037/00037ed2-351a-4741-8ce6-a2078f21ba6b/videoSD/0_1.mp4" } ] } ] }
  • 下载示例 通过调用接口,获取到下载链接和鉴权token后,可以通过以下示例代码(Java)下载录制文件: /** * 录制文件下载 * * @param downloadUrl 录制文件下载链接 * @param localPath 本地保存路径 * @param token 下载鉴权token */ public static void httpDownload(String downloadUrl, String localPath, String token) { int byteRead; try { URL url = new URL(downloadUrl); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); // 请求头域中携带下载鉴权token connection.setRequestProperty("Authorization", token); connection.setHostnameVerifier(new HostnameVerifier() { @Override public Boolean verify(String hostname, SSLSession sslSession) { return true; } }); TrustManager[] trustManagers = new TrustManager[]{ new X509TrustManager() { public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { } public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { } public X509Certificate[] getAcceptedIssuers() { return null; } } }; SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(null, trustManagers, null); connection.setSSLSocketFactory(ctx.getSocketFactory()); // 获取文件流 InputStream inStream = connection.getInputStream(); // 保存到本地路径下 FileOutputStream fs = new FileOutputStream(localPath); byte[] buffer = new byte[1024]; while ((byteRead = inStream.read(buffer)) != -1) { fs.write(buffer, 0, byteRead); } inStream.close(); fs.close(); } catch (IOException | KeyManagementException | NoSuchAlgorithmException e) { e.printStackTrace(); } }
  • CURL命令示例 curl -k -i -X GET -H 'X-Access-Token:stbX5ElstO5QwOwPB9KGQWUZ1DHoFrTsQjjC' 'https://api.meeting.huaweicloud.com/v1/mmc/management/record/downloadurls?confUUID=51adf610220411eaaae03f22d33cc26b'
  • 请求参数 表2 参数说明 参数 是否必须 类型 位置 描述 confUUID 是 String Query 会议UUID(通过查询录制列表获取)。 offset 否 Integer Query 查询偏移量。默认为0。 limit 否 Integer Query 查询数量。默认是20,最大500条。 X-Access-Token 是 String Header 授权令牌。获取“执行App ID鉴权”响应的accessToken。 X-Authorization-Type 否 String Header 标识是否为第三方portal过来的请求。 说明: 该参数将废弃,请勿使用。 X-Site-Id 否 String Header 用于区分到哪个H CS O站点鉴权。 说明: 该参数将废弃,请勿使用。