wish接口

wish商户平台API

刷新访问令牌

 

1.access_token过期后使用refresh_token,获取新的access_token

Refreshing Access Token

Access tokens expire after a certain period of time. In order to obtain a new access token without going through the full oAuth process again, your app can make the following request:

GET https://merchant.wish.com/api/v3/oauth/refresh_token

Parameters

client_idYour app's client ID
client_secretYour app's client secret
refresh_tokenYour refresh token
grant_typeThe string 'refresh_token'
	String client_id = "";
	String client_secret = "";
	String refresh_token = "";
	String url = "https://merchant.wish.com/api/v3/oauth/refresh_token?client_id=" + client_id + "&client_secret=" + client_secret + "&refresh_token=" + refresh_token + "&grant_type=refresh_token";
	String type = "GET";
	String strJson = new com.github.kevinsawicki.http.HttpRequest(url, type).body();
	System.out.println(strJson);

返回结果:

{
	"message": "",
	"code": 0,
	"data": {
		"access_token": "7f801156e6d2458eafb1373978c4bd10",
		"scopes": ["orders:read", "orders:write", "products:read", "products:write"],
		"merchant_id": "1f801156e6d2458eafb1373978c4bd10",
		"expiry_time": "2022-10-19T04:16:35.661+00:00",
		"refresh_token": "2f801156e6d2458eafb1373978c4bd10"
	}
}

 

2.检索最近更改的订单

Retrieve Recently Changed Orders

GET https://merchant.wish.com/api/v2/order/multi-get

	String access_token = "";
	String start_time = "2014-01-20T20:10:20";
	String end_time = "2014-01-20T20:10:20";
	String url = "https://merchant.wish.com/api/v2/order/multi-get?upto=" + end_time + "&start=0&limit=2&access_token=" + access_token + "&since=" + start_time;
	String strParams = new com.github.kevinsawicki.http.HttpRequest(url, "GET").body();

如果返回{"message":"This access token has been revoked.","code":1016,"data":{}},说明token过期了,需要重新获取token。

它的下一页next是一个完整的url,直接调用即可。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值