一口气整理各种快递物流查询API 的Java调用代码

网友投稿 196 2024-01-15

在数字化时代,物流行业迎来了全新的变革和机遇。全国快递物流查询API作为一项创新技术,正在引领着物流业的数字化转型和智能化革新。

本文将提供各种快递查询 API的接入Java代码,有需要的小伙伴自取~

实时快递查询

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"cpCode":"YTO","mailNo":"YTO1111111111","tel":"13000000000或0000","orderType":"asc"}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/wlgj1/paidtobuy_api/trace_search") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

注意:API_KEY 到 APISpace 登录获取即可。

快递批量实时查询

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"data":[{"cpCode":"YTO","mailNo":"YTO1111111111","tel":"13000000000或0000"}],"cpCode":"YTO","mailNo":"YTO1111111111","tel":"13000000000或0000"}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/wlgj1/paidtobuy_api/trace_batch_search") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

识别电子面单号(免费)

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"mailNo":"YTO1111111111"}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/wlgj1/paidtobuy_api/mail_discern") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

物流轨迹地图获取

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"cpCode":"YTO","mailNo":"YTO1111111111","phone":"1300000000","origin":"浙江省杭州市滨江区","destination":"浙江省杭州市滨江区","receiveAddress":"江南大道","responseModel":"H5"}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/wldtgj1/paidtobuy_api/trace_map") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

物流订阅与推送

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"cpCode":"","mailNo":"","phone":"","callBackUrl":""}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/wldtgj1/paidtobuy_api/trace_subscribe") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

国际物流订阅

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"cpCode":"","mailNo":""}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/internationallogistics/subscribe") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

国际物流查询

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"cpCode":"","mailNo":""}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/internationallogistics/trace") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

快递可达校验

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"cpCode":"YTO","province":"广东省","city":"东莞市","country":"","town":"大朗镇","address":"杨新路82号"}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/kdkdjy1/paidtobuy_api/address_reachable") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

物流时效性查询

OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{"sendProvince":"","sendCity":"","sendDistrict":"","recvProvince":"","recvCity":"","recvDistrict":""}"); Request request = new Request.Builder() .url("https://eolink.o.apispace.com/logisticstimeliness/get") .method("POST",body) .addHeader("X-APISpace-Token","API_KEY") // API_KEY 需要替换为APISpace 提供的API 密钥 .addHeader("Authorization-Type","apikey") .addHeader("Content-Type","application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string());

写在最后

如果需要其他开发语言的小伙伴,欢迎评论区留言~

Last Updated on 2023-06-07 by admin

31

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:python怎么做到不覆盖拷贝文件
下一篇:mfc怎么显示属性窗口
相关文章

 发表评论

暂时没有评论,来抢沙发吧~