DefaultTaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret"); TimeGetRequest request = new TimeGetRequest(); TimeGetResponse response = client.execute(request); if (response.isSuccess()) { System.out.println(response.getBody()); }
String url = new String("http://gw.api.taobao.com/router/rest"); TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret); AliexpressLogisticsRedefiningGetonlinelogisticsinfoRequest req = new AliexpressLogisticsRedefiningGetonlinelogisticsinfoRequest(); req.setChinaLogisticsId("LA234234CN"); req.setInternationalLogisticsId("LP00038357949881"); req.setLogisticsStatus("CLOSED"); req.setGmtCreateEndStr("2016-06-27 18:15:00"); req.setPageSize(10L); req.setQueryExpressOrder(false); req.setCurrentPage(1L); req.setOrderId(60015640573917L); req.setGmtCreateStartStr("2016-06-27 18:20:00"); AliexpressLogisticsRedefiningGetonlinelogisticsinfoResponse rsp = client.execute(req, sessionKey); System.out.println(rsp.getBody());
The following table lists API service URLs.
Environment | HTTP Request URL | HTTPS Request URL |
---|---|---|
Formal environment | http://gw.api.taobao.com/router/rest | https://eco.taobao.com/router/rest |
Overseas formal environment | http://api.taobao.com/router/rest | https://api.taobao.com/router/rest |
DefaultTaobaoClient.setNeedEnableParser(false);
DefaultTaobaoClient.setUseSimplifyJson(true);
DefaultTaobaoClient.setNeedEnableLogger(false);
DefaultTaobaoClient.setIgnoreSSLCheck(true);
DefaultTaobaoClient.setUseGzipEncoding(false);
//Default timeout interval for an HTTP connection: 3s //Default timeout interval for an HTTP read response: 15s DefaultTaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret", connectTimeout, readTimeout)
AutoRetryTaobaoClient client = new AutoRetryTaobaoClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret"); client.setMaxRetryCount(3); client.setRetryWaitTime(100L); TimeGetRequest request = new TimeGetRequest(); TimeGetResponse response = client.execute(request); if (response.isSuccess()) { System.out.println(response.getBody()); }
ClusterTaobaoClient client = new ClusterTaobaoClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret"); TimeGetRequest request = new TimeGetRequest(); TimeGetResponse response = client.execute(request); System.out.println(response.getBody());