首页 > 其他分享 >官方版.NET SDK连线更新(2011/01/19)

官方版.NET SDK连线更新(2011/01/19)

时间:2022-11-27 16:33:43浏览次数:68  
标签:01 http 19 com req client taobao 官方版 rsp


2010/01/19新增功能:
1. 修正旺旺API返回结果不正确的问题
2. 修正JSON解释带换行符结果的问题

下载地址:
1. Google Code: http://top4net.googlecode.com/files/taobao-sdk-net-20110119.zip
2. 官方下载地址: ​​​http://dl.open.taobao.com/sdk/taobao-sdk-net.zip​​​

相比Top4Net,官方版的SDK主要包含以下特性:
1. 更直观和方便的调用方式
2. 使用IsError的方式取代抛异常
3. 支持所有API(包括旺旺,淘江湖。。。)
4. 直接通过源码就可以查看文档描述
5. XML解释性能提升
6. 支持JSON解释(基于.NET 2.0)

调用示例:
1) 获取用户公开数据



  1. ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret", "xml");
  2. UserGetRequest req = new
  3. req.Fields = "user_id,nick,created,buyer_credit,type,sex";
  4. req.Nick = "helloworld";
  5. UserGetResponse rsp = client.Execute(req);
  6. if (rsp.IsError)
  7. {
  8. // 异常处理
  9. }
  10. Console.WriteLine(rsp.Body);




2) 添加一个商品




  1. ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret", "json");
  2. ItemAddRequest req = new
  3. req.ApproveStatus = "onsale";
  4. req.ListTime = DateTime.Now;
  5. req.Num = 100L;
  6. req.Price = "88.00";
  7. req.Type = "fixed";
  8. req.StuffStatus = "new";
  9. req.Title = "iphone4 v5";
  10. req.Desc = "how are you doing";
  11. req.LocationState = "浙江";
  12. req.LocationCity = "杭州";
  13. req.FreightPayer = "buyer";
  14. req.PostFee = "12.00";
  15. req.ExpressFee = "6.00";
  16. req.OuterId = "100001";
  17. req.Cid = 2203L;
  18. req.Props = "20000:44506;1627207:3232484;20055:27842";
  19. req.Image = new
  20. ItemAddResponse rsp = client.Execute(req, "sessionKey");
  21. Console.WriteLine(rsp.Body);




3) 增量订单下载




  1. ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret", "json");
  2. TradesSoldIncrementGetRequest req = new
  3. req.StartModified = DateTime.Parse("2010-10-13 00:00:00");
  4. req.EndModified = DateTime.Parse("2010-10-13 23:59:59");
  5. req.UseHasNext = true;
  6. req.PageNo = 1;
  7. req.PageSize = 10;
  8. req.Fields = "tid,buyer_nick,seller_nick,modified,orders.iid,orders.title,orders.price";
  9. TradesSoldIncrementGetResponse rsp = null;
  10. do
  11. {
  12. rsp = client.Execute(req, "sessionKey");
  13. req.PageNo++;
  14. Console.WriteLine(rsp.Body);
  15. } while (rsp != null && rsp.HasNext);




4) 查询物流跟踪信息




  1. ITopClient client = new DefaultTopClient("http://gw.api.taobao.com/router/rest", "appkey", "appsecret", "json");
  2. LogisticsTraceSearchRequest req = new
  3. req.SellerNick = "奥迅运动户外专营店";
  4. req.Tid = 55070989240898L;
  5. LogisticsTraceSearchResponse rsp = client.Execute(req);
  6. Console.WriteLine(rsp.Body);

标签:01,http,19,com,req,client,taobao,官方版,rsp
From: https://blog.51cto.com/u_15834343/5890195

相关文章