系列文章目录
第二章 玩转PostMan之调试天气接口-心知天气 API
文章目录
概要
提示:以下是本篇文章正文内容,下面案例可供参考
一、科普
HyperData 是心知天气的高精度气象数据产品,通过标准的 Restful API 接口,提供标准化的数据访问。
无论是 APP、智能硬件还是企业级系统都可以轻松接入心知的精细化天气数据。
二、使用步骤
java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.seniverse.com/v3/weather/now.json?key=xxxx&location=beijing&language=zh-Hans&unit=c")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
总结
如果用于商业目的,建议如下
- 把key做成可配的,默认免费版,有客户需要,定制换成收费的key。