易趣API FindItemsByProduct无法退回固定价格列表中的可用商品

时间:2016-05-05 20:43:55

标签: c# ebay-api

我正在尝试使用eBay API findItemsByProduct检索固定价格列表中的可用商品数量,但无法找到包含该信息的属性。

是否有人知道此次通话是否可以访问可用的项目数量,或者我是否可以使用其他API?

using (FindingServicePortTypeClient client = new FindingServicePortTypeClient())
{
  MessageHeader header = MessageHeader.CreateHeader("My-CustomHeader", "http://www.mycustomheader.com","Custom Header");
  using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
  {
    OperationContext.Current.OutgoingMessageHeaders.Add(header);
    HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();    
    httpRequestProperty.Headers.Add("X-EBAY-SOA-SECURITY-APPNAME", "INSERT APP ID");
    httpRequestProperty.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "findItemsByProduct");
    httpRequestProperty.Headers.Add("X-EBAY-SOA-GLOBAL-ID", "EBAY-US");
    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
    FindItemsByProductRequest request = new FindItemsByProductRequest();
    ProductId id = new ProductId();
    request.productId = id;
    request.productId.type = "UPC";
    request.productId.Value = "783722722428";
    request.sortOrder = SortOrderType.PricePlusShippingLowest;

    FindItemsByProductResponse response = client.findItemsByProduct(request);

    foreach (var item in response.searchResult.item)
    {
      Console.WriteLine(item.title); 
      Console.WriteLine("Item Condition:  " + Item.condition.conditionDisplayName);
      Console.WriteLine("Item ID:         " + item.itemId);
      Console.WriteLine("URL:             " +item.viewItemURL);
      Console.WriteLine("Listing Type:    " +  item.listingInfo.listingType);
      Console.WriteLine("Price:           " + item.sellingStatus.currentPrice.Value);
      Console.WriteLine("Shipping Type:   " + item.shippingInfo.shippingType);
      if  (item.shippingInfo.shippingServiceCost != null)
      { 
        Console.WriteLine("Shipping:      " + item.shippingInfo.shippingServiceCost.Value); }
        // Console.WriteLine(item.condition.conditionDisplayName);
        //Console.WriteLine(item.galleryPlusPictureURL);
        Console.WriteLine("");
        Console.WriteLine("");
      }  // if
    }    // foreach
  }      // using
}        // using

1 个答案:

答案 0 :(得分:0)

JMS

Ebay在C#中有一个sdk,非常有用且易于使用。

https://go.developer.ebay.com/netsdk

要列出您的有效产品,请使用致电ActiveInventoryReport