唯品会接口代码实例

try {
//2、设置系统级调用参数
ClientInvocationContext instance = new ClientInvocationContext();
instance.setAppKey(" appKey");//替换为你的appKey
instance.setAppSecret(" appSecret");//替换为你的appSecret
//instance.setAccessToken("accessToken");//替换为你的accessToken,通过Oauth认证时必填
instance.setAppURL("http://sandbox.vipapis.com/");//沙箱环境
//instance.setAppURL("http://gw.vipapis.com/");//正式环境
//instance.setReadTimeOut(30000);//读写超时时间,可选,默认30秒
//instance.setConnectTimeOut(5000);//连接超时时间,可选,默认5秒

//3、设置client的调用上下文
client.setClientInvocationContext(instance);

//4、调用API及返回
List<ProvinceWarehouse> provinceWarehouse = client.getProvinceWarehouse(vipapis.address.Is_Show_GAT.SHOW_ALL);


System.out.println("返回的结果为:"+provinceWarehouse);
} catch (OspException e) {
//4、捕获异常
System.out.println(client.getClientInvocationContext().getLastInvocation().getSign());//获取最近一次调用的sign值
}

猜你喜欢

转载自blog.csdn.net/cafuf/article/details/80792130