在eBay中以买家身份获取货件跟踪编号

时间:2019-01-02 01:50:46

标签: c# .net ebay

我正在使用eBay SDK来获取购买历史记录,并且试图获取所购买商品的运输跟踪号,但是我没有运气

我尝试了这些代码

ApiContext context = new ApiContext();
            //set the User token
            context.ApiCredential.eBayToken = "Token";
            context.ApiCredential.ApiAccount.Application = "ID";
            context.ApiCredential.ApiAccount.Developer = "ID";
            context.ApiCredential.ApiAccount.Certificate = "ID";
            //set the server url
            context.SoapApiServerUrl = "https://api.ebay.com/wsapi";
            //set the version
            context.Version = "817";
            context.Site = SiteCodeType.US;
            DateTime CreateTimeFrom, CreateTimeTo;
            GetOrdersCall getOrders = new GetOrdersCall(context);
            GetMyeBayBuyingCall getBuy = new GetMyeBayBuyingCall(context);
            getBuy.WonList = new ItemListCustomizationType();
            getBuy.WonList.Pagination = new PaginationType();
            getBuy.WonList.Pagination.EntriesPerPage = 2;
            getBuy.DetailLevelList = new DetailLevelCodeTypeCollection();
            getBuy.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            getBuy.GetMyeBayBuying(); //////////
            //CreateTimeTo set to the current time
            CreateTimeTo = DateTime.Now.ToUniversalTime();
            DateTime.TryParse("2018/12/12", out CreateTimeFrom);
            getOrders.CreateTimeFrom = CreateTimeFrom;
            TimeFilter fltr = new TimeFilter(CreateTimeFrom, CreateTimeTo);
            getOrders.GetOrders(fltr, (TradingRoleCodeType)Enum.Parse(typeof(TradingRoleCodeType), "Buyer"), (OrderStatusCodeType)Enum.Parse(typeof(OrderStatusCodeType), "All")); ///////
            //getOrders.Execute(); /////////////
            if (getOrders.ApiResponse.Ack != AckCodeType.Failure)
           {
                //Check if any orders are returned
                if (getOrders.ApiResponse.OrderArray.Count != 0)
                {
                    foreach (OrderType order in getOrders.ApiResponse.OrderArray)
                    {

                        //Update your system with the order information.
                        GetOrdersCall ordersCall = new GetOrdersCall(context);
                        StringCollection a = new StringCollection();
                        a.Add(order.OrderID);
                        ordersCall.GetOrders(a);////////

                    }

                }
                else
                {
                }

            }

我尝试了所有////////旁边的方法,它们都返回项目信息,但是它们的名词返回跟踪信息,即使有使用方法,也可以通过任何方式获取跟踪号REST API或其他任何方法(如果我无法使用此方法获取它们的话)

谢谢

0 个答案:

没有答案