你好,我现在想通过api查询微商城的订单列表。token成功获取了,那下一步如何使用这个token呢?文档里有php和java的代码示例,但我用的是C#,能给个示例代码吗?或者帮看下下面的C#代码有什么问题:
string getOrderList2()
{
string token = getToken();
string url = "https://open.youzanyun.com/api/youzan.trades.sold.get/4.0.1";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);//webrequest请求api地址
request.ContentType = "application/json";
request.Method = "GET";//get或者post
request.Headers.Add("Authorization", token);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
string resultStr = reader.ReadToEnd();
return resultStr;
}
}
|
|
用手机打开
收藏
赞 0
···
回复
|
|
|
|