wish接口
wish商户平台API刷新访问令牌1.access_token过期后使用refresh_token,获取新的access_tokenRefreshing Access TokenAccess tokens expire after a certain period of time. In order to obtain a new access token without going throug
·
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_id | Your app's client ID |
---|---|
client_secret | Your app's client secret |
refresh_token | Your refresh token |
grant_type | The 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,直接调用即可。
更多推荐
已为社区贡献1条内容
所有评论(0)