Foxtable(狐表)用户栏目专家坐堂 → [求助]这个tbapi接口怎么写?


  共有384人关注过本帖树形打印复制链接

主题:[求助]这个tbapi接口怎么写?

帅哥哟,离线,有人找我吗?
zto001
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:955 积分:6523 威望:0 精华:0 注册:2018/10/16 11:42:00
[求助]这个tbapi接口怎么写?  发帖心情 Post By:2020/1/6 19:57:00 [只看该作者]

https://open.taobao.com/api.htm?docId=23869&docType=2


.net代码

ITopClient client = new DefaultTopClient(url, appkey, secret); WlbWaybillIGetRequest req = new WlbWaybillIGetRequest(); WlbWaybillIGetRequest.WaybillApplyNewRequestDomain obj1 = new WlbWaybillIGetRequest.WaybillApplyNewRequestDomain(); obj1.CpCode = "ZTO"; WlbWaybillIGetRequest.WaybillAddressDomain obj2 = new WlbWaybillIGetRequest.WaybillAddressDomain(); obj2.Area = "朝阳区"; obj2.Province = "北京"; obj2.Town = "八里庄"; obj2.AddressDetail = "朝阳路高井,财满街,财经中心9号楼21单元6013"; obj2.City = "北京市"; obj1.ShippingAddress= obj2; List<WlbWaybillIGetRequest.TradeOrderInfoDomain> list4 = new List<WlbWaybillIGetRequest.TradeOrderInfoDomain>(); WlbWaybillIGetRequest.TradeOrderInfoDomain obj5 = new WlbWaybillIGetRequest.TradeOrderInfoDomain(); list4.Add(obj5); obj5.ConsigneeName = "张三"; obj5.OrderChannelsType = "TB"; obj5.TradeOrderList = "12321321,12321321"; obj5.ConsigneePhone = "13242422352"; WlbWaybillIGetRequest.WaybillAddressDomain obj6 = new WlbWaybillIGetRequest.WaybillAddressDomain(); obj6.Area = "朝阳区"; obj6.Province = "北京"; obj6.Town = "八里庄"; obj6.AddressDetail = "朝阳路高井,财满街,财经中心9号楼21单元6013"; obj6.City = "北京市"; obj5.ConsigneeAddress= obj6; obj5.SendPhone = "13242422352"; obj5.Weight = 123L; obj5.SendName = "李四"; List<WlbWaybillIGetRequest.PackageItemDomain> list8 = new List<WlbWaybillIGetRequest.PackageItemDomain>(); WlbWaybillIGetRequest.PackageItemDomain obj9 = new WlbWaybillIGetRequest.PackageItemDomain(); list8.Add(obj9); obj9.ItemName = "衣服"; obj9.Count = 123L; obj5.PackageItems= list8; List<WlbWaybillIGetRequest.LogisticsServiceDomain> list11 = new List<WlbWaybillIGetRequest.LogisticsServiceDomain>(); WlbWaybillIGetRequest.LogisticsServiceDomain obj12 = new WlbWaybillIGetRequest.LogisticsServiceDomain(); list11.Add(obj12); obj12.ServiceValue4Json = "{ \"value\": \"100.00\",\"currency\": \"CNY\",\"ensure_type\": \"0\"}"; obj12.ServiceCode = "SVC-DELIVERY-ENV"; obj5.LogisticsServiceList= list11; obj5.ProductType = "STANDARD_EXPRESS"; obj5.RealUserId = 13123L; obj5.Volume = 123L; obj5.PackageId = "E12321321-1234567"; obj1.TradeOrderInfoCols= list4; req.WaybillApplyNewRequest_ = obj1; WlbWaybillIGetResponse rsp = client.Execute(req, sessionKey); Console.WriteLine(rsp.Body);

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:41622 积分:211534 威望:0 精华:8 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/6 20:22:00 [只看该作者]

下载.net版本的sdk,引用后直接使用即可:https://open.taobao.com/doc.htm?spm=a219a.7386653.0.0.715c669axWNMYF&docId=101618&docType=1

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:955 积分:6523 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/1/7 9:49:00 [只看该作者]

引用后怎么写?比如引用命名为tbnet.dll


 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:41622 积分:211534 威望:0 精华:8 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/7 10:00:00 [只看该作者]

把上面代码转换为vbnet:http://converter.telerik.com/,直接使用即可

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:955 积分:6523 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/1/7 10:39:00 [只看该作者]

Private Sub SurroundingSub()
    Dim client As ITopClient = New DefaultTopClient(url, appkey, secret)
    Dim req As WlbWaybillIGetRequest = New WlbWaybillIGetRequest()
    Dim obj1 As WlbWaybillIGetRequest.WaybillApplyNewRequestDomain = New WlbWaybillIGetRequest.WaybillApplyNewRequestDomain()
    obj1.CpCode = "ZTO"
    Dim obj2 As WlbWaybillIGetRequest.WaybillAddressDomain = New WlbWaybillIGetRequest.WaybillAddressDomain()
    obj2.Area = "朝阳区"
    obj2.Province = "北京"
    obj2.Town = "八里庄"
    obj2.AddressDetail = "朝阳路高井,财满街,财经中心9号楼21单元6013"
    obj2.City = "北京市"
    obj1.ShippingAddress = obj2
    Dim list4 As List(Of WlbWaybillIGetRequest.TradeOrderInfoDomain) = New List(Of WlbWaybillIGetRequest.TradeOrderInfoDomain)()
    Dim obj5 As WlbWaybillIGetRequest.TradeOrderInfoDomain = New WlbWaybillIGetRequest.TradeOrderInfoDomain()
    list4.Add(obj5)
    obj5.C
    obj5.OrderChannelsType = "TB"
    obj5.TradeOrderList = "12321321,12321321"
    obj5.C
    Dim obj6 As WlbWaybillIGetRequest.WaybillAddressDomain = New WlbWaybillIGetRequest.WaybillAddressDomain()
    obj6.Area = "朝阳区"
    obj6.Province = "北京"
    obj6.Town = "八里庄"
    obj6.AddressDetail = "朝阳路高井,财满街,财经中心9号楼21单元6013"
    obj6.City = "北京市"
    obj5.ConsigneeAddress = obj6
    obj5.SendPh
    obj5.Weight = 123L
    obj5.SendName = "李四"
    Dim list8 As List(Of WlbWaybillIGetRequest.PackageItemDomain) = New List(Of WlbWaybillIGetRequest.PackageItemDomain)()
    Dim obj9 As WlbWaybillIGetRequest.PackageItemDomain = New WlbWaybillIGetRequest.PackageItemDomain()
    list8.Add(obj9)
    obj9.ItemName = "衣服"
    obj9.Count = 123L
    obj5.PackageItems = list8
    Dim list11 As List(Of WlbWaybillIGetRequest.LogisticsServiceDomain) = New List(Of WlbWaybillIGetRequest.LogisticsServiceDomain)()
    Dim obj12 As WlbWaybillIGetRequest.LogisticsServiceDomain = New WlbWaybillIGetRequest.LogisticsServiceDomain()
    list11.Add(obj12)
    obj12.ServiceValue4Json = "{ ""value"": ""100.00"",""currency"": ""CNY"",""ensure_type"": ""0""}"
    obj12.ServiceCode = "SVC-DELIVERY-ENV"
    obj5.LogisticsServiceList = list11
    obj5.ProductType = "STANDARD_EXPRESS"
    obj5.RealUserId = 13123L
    obj5.Volume = 123L
    obj5.PackageId = "E12321321-1234567"
    obj1.TradeOrderInfoCols = list4
    req.WaybillApplyNewRequest_ = obj1
    Dim rsp As WlbWaybillIGetResponse = client.Execute(req, sessionKey)
    Console.WriteLine(rsp.Body)
End Sub

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:955 积分:6523 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/1/7 10:39:00 [只看该作者]

是不是要放在全局代码里面?

 回到顶部
帅哥,在线噢!
有点蓝
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:41622 积分:211534 威望:0 精华:8 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/7 10:47:00 [只看该作者]

去掉第一行和最后2行,写全命名空间:Dim client As xxxxx.ITopClient = New xxxx.DefaultTopClient(url, appkey, secret)

放到按钮里执行

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:955 积分:6523 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/1/10 17:37:00 [只看该作者]

是这样写在按钮里吗?好像错了

Dim client As xxxx.ITopClient = New xxxx.DefaultTopClient(url, appkey, secret)

    Dim client As ITopClient = New DefaultTopClient(url, appkey, secret)
    Dim req As WlbWaybillIGetRequest = New WlbWaybillIGetRequest()
    Dim obj1 As WlbWaybillIGetRequest.WaybillApplyNewRequestDomain = New WlbWaybillIGetRequest.WaybillApplyNewRequestDomain()
    obj1.CpCode = "ZTO"
    Dim obj2 As WlbWaybillIGetRequest.WaybillAddressDomain = New WlbWaybillIGetRequest.WaybillAddressDomain()
    obj2.Area = "朝阳区"
    obj2.Province = "北京"
    obj2.Town = "八里庄"
    obj2.AddressDetail = "朝阳路高井,财满街,财经中心9号楼21单元6013"
    obj2.City = "北京市"
    obj1.ShippingAddress = obj2
    Dim list4 As List(Of WlbWaybillIGetRequest.TradeOrderInfoDomain) = New List(Of WlbWaybillIGetRequest.TradeOrderInfoDomain)()
    Dim obj5 As WlbWaybillIGetRequest.TradeOrderInfoDomain = New WlbWaybillIGetRequest.TradeOrderInfoDomain()
    list4.Add(obj5)
    obj5.C
    obj5.OrderChannelsType = "TB"
    obj5.TradeOrderList = "12321321,12321321"
    obj5.C
    Dim obj6 As WlbWaybillIGetRequest.WaybillAddressDomain = New WlbWaybillIGetRequest.WaybillAddressDomain()
    obj6.Area = "朝阳区"
    obj6.Province = "北京"
    obj6.Town = "八里庄"
    obj6.AddressDetail = "朝阳路高井,财满街,财经中心9号楼21单元6013"
    obj6.City = "北京市"
    obj5.ConsigneeAddress = obj6
    obj5.SendPh
    obj5.Weight = 123L
    obj5.SendName = "李四"
    Dim list8 As List(Of WlbWaybillIGetRequest.PackageItemDomain) = New List(Of WlbWaybillIGetRequest.PackageItemDomain)()
    Dim obj9 As WlbWaybillIGetRequest.PackageItemDomain = New WlbWaybillIGetRequest.PackageItemDomain()
    list8.Add(obj9)
    obj9.ItemName = "衣服"
    obj9.Count = 123L
    obj5.PackageItems = list8
    Dim list11 As List(Of WlbWaybillIGetRequest.LogisticsServiceDomain) = New List(Of WlbWaybillIGetRequest.LogisticsServiceDomain)()
    Dim obj12 As WlbWaybillIGetRequest.LogisticsServiceDomain = New WlbWaybillIGetRequest.LogisticsServiceDomain()
    list11.Add(obj12)
    obj12.ServiceValue4Json = "{ ""value"": ""100.00"",""currency"": ""CNY"",""ensure_type"": ""0""}"
    obj12.ServiceCode = "SVC-DELIVERY-ENV"
    obj5.LogisticsServiceList = list11
    obj5.ProductType = "STANDARD_EXPRESS"
    obj5.RealUserId = 13123L
    obj5.Volume = 123L
    obj5.PackageId = "E12321321-1234567"
    obj1.TradeOrderInfoCols = list4
    req.WaybillApplyNewRequest_ = obj1
    Dim rsp As WlbWaybillIGetResponse = client.Execute(req, sessionKey)



 回到顶部
帅哥,在线噢!
有点蓝
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:41622 积分:211534 威望:0 精华:8 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/1/10 17:39:00 [只看该作者]

xxxx改为真正的命名空间名称,这个名称请看sdk源码,或者问接口方。

不仅仅是第一行代码,所有代码有调用到sdk类型的地方都加上完整的命名空间名称

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:955 积分:6523 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/1/10 18:53:00 [只看该作者]

引用的文件是TopSdk.dll  还有哪里调用了?

 回到顶部
总数 47 1 2 3 4 5 下一页