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); AliexpressLogisticsRedefiningListlogisticsserviceRequest req = new AliexpressLogisticsRedefiningListlogisticsserviceRequest(); AliexpressLogisticsRedefiningListlogisticsserviceResponse 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());