准备工作
更新时间:2018-05-28 15:16:45
调用示例
// https://github.com/aliyun/iotx-api-gateway-client public static void main(String[] args) throws UnsupportedEncodingException { SyncApiClient syncClient = SyncApiClient.newBuilder() .appKey("你的<AppKey>") .appSecret("你的<AppSecret>") .build(); IoTApiRequest request = new IoTApiRequest(); //设置api的版本 request.setApiVer("1.0.0"); request.setCloudToken("CloudTokenXXXXX"); //设置接口的参数 request.putParam("grantType", "project"); request.putParam("res", "xxxxx"); //请求参数域名、path、request ApiResponse response = syncClient.postBody("api.link.aliyun.com", "/cloud/token", request, true); System.out.println( "response code = " + response.getStatusCode() + " response content = " + new String(response.getBody(), "utf-8")); }