云服务器内容精选
-
请求签名与API调用 在Android工程中的“app/libs”目录下,加入SDK所需jar包。其中jar包必须包括: java-sdk-core-x.x.x.jar commons-logging-1.2.jar joda-time-2.9.9.jar 在“build.gradle”文件中加入okhttp库的依赖。 在“build.gradle”文件中的“dependencies”下加入“implementation 'com.squareup.okhttp3:okhttp:3.11.0'”。 1 2 3 4 5 dependencies { ... ... implementation 'com.squareup.okhttp3:okhttp:3.11.0' } 创建request,输入AK和SK,并指定域名、方法名、请求uri和body。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Request request = new Request(); try { // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. // In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. request.setKey(System.getenv("HUAWEICLOUD_SDK_AK")); request.setSecret(System.getenv("HUAWEICLOUD_SDK_SK")); request.setMethod("GET"); request.setUrl("https://service.region.example.com3/v1/{project_id}/vpcs"); request.addQueryStringParam("name", "value"); request.addHeader("Content-Type", "text/plain"); //request.setBody("demo"); } catch (Exception e) { e.printStackTrace(); return; } 对请求进行签名,生成okhttp3.Request对象来访问API。 1 2 3 okhttp3.Request signedRequest = Client.signOkhttp(request); OkHttpClient client = new OkHttpClient.Builder().build(); Response response = client.newCall(signedRequest).execute();
-
获取SDK 签名SDK只包含签名功能,不包含云服务的SDK功能,云服务SDK请参见SDK。 点此下载SDK与Demo。 解压时选择解压到当前文件夹,解压后目录结构如下: 名称 说明 hasher.cpp SDK代码 hasher.h header.h RequestParams.cpp RequestParams.h signer.cpp signer.h constants.h Makefile Makefile文件 main.cpp 示例代码
更多精彩内容
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格