如何获取易贝EBAY商品详情 API 返回值说明?

292 阅读3分钟

易贝(eBay)是一个在线拍卖和购物网站,提供了一个API(应用程序接口)供开发者获取商品详情等信息。使用eBay的API,你可以编写应用程序来查询商品、检索拍卖详情、跟踪订单等。

当你调用eBay的API获取商品详情时,通常会返回一个JSON或XML格式的响应,这个响应包含了商品的详细信息。以下是一个简化的JSON格式的eBay商品详情API返回值示例及说明:

{
  "ack": "Success",
  "version": "1.13.0",
  "timestamp": "2023-04-25T12:34:56.789Z",
  "build": "E1234567",
  "Item": {
    "ItemID": "123456789012",
    "Title": "Brand New Laptop",
    "PrimaryCategory": {
      "CategoryID": "12345",
      "CategoryName": "Laptops & Netbooks"
    },
    "StartPrice": {
      "currencyID": "USD",
      "__value__": "999.99"
    },
    "CurrentPrice": {
      "currencyID": "USD",
      "__value__": "999.99"
    },
    "HighBidder": {
      "UserID": "bidder123",
      "UserName": "HighBidderUser"
    },
    "QuantitySold": "10",
    "ListingInfo": {
      "ListingDuration": "GTC",
      "ListingType": "FixedPriceItem",
      "BestOfferEnabled": "false"
    },
    "PaymentMethods": "PayPal",
    "ShippingInfo": {
      "ShippingServiceCost": {
        "currencyID": "USD",
        "__value__": "0.00"
      },
      "ShipToLocations": "US",
      "ExpeditedShipping": "false"
    },
    "PictureURL": "https://example.com/item-picture.jpg",
    "ViewItemURLForNaturalSearch": "https://www.ebay.com/itm/Brand-New-Laptop/123456789012",
    "Description": "This is a brand new laptop computer...",
    "Seller": {
      "UserID": "seller123",
      "UserName": "SellerUser"
    }
    // 其他可能存在的字段,如Location, HandlingTime, ShippingIncludesInsurance等
  }
}

返回值说明:

  • ack: API调用的响应状态,通常是"Success"表示成功,"Failure"表示失败。
  • version: API的版本号。
  • timestamp: 请求处理的时间戳。
  • build: eBay系统的构建版本号。
  • Item: 商品信息对象。
    • ItemID: 商品的唯一ID。
    • Title: 商品标题。
    • PrimaryCategory: 商品的主要分类信息。
      • CategoryID: 分类ID。
      • CategoryName: 分类名称。
    • StartPrice: 商品的起始价格。
      • currencyID: 货币类型,如USD。
      • __value__: 价格值。
    • CurrentPrice: 商品的当前价格(对于固定价格商品或当前竞拍价格)。
    • HighBidder: 当前最高出价者的信息。
      • UserID: 出价者ID。
      • UserName: 出价者用户名。
    • QuantitySold: 已售出的商品数量。
    • ListingInfo: 列表信息。
      • ListingDuration: 列表持续时间,如GTC(Good Until Canceled,直到取消为止)。
      • ListingType: 列表类型,如FixedPriceItem(固定价格商品)。
      • BestOfferEnabled: 是否启用“最佳报价”功能。
    • PaymentMethods: 支付方式,如PayPal。
    • ShippingInfo: 运输信息。
      • ShippingServiceCost: 运输服务费用。
      • ShipToLocations: 可发货地点。
      • ExpeditedShipping: 是否提供加急运输。
    • PictureURL: 商品的图片URL。
    • ViewItemURLForNaturalSearch: 商品的自然搜索URL。
    • Description: 商品的描述。
    • Seller: 卖家信息。
      • UserID: 卖家ID。
      • UserName: 卖家用户名。

请注意,实际的API返回值可能会比这个示例更加复杂,是的,我之前的示例只是一个简化的、概念性的返回值结构。在实际使用中,EBAY商品详情API的返回值可能会包含更多的字段和嵌套结构,具体取决于你请求的商品和API的版本。

以下是一些可能存在的额外字段和结构的例子:

{
  "ack": "Success",
  "version": "1.0",
  "timestamp": "2023-04-01T12:34:56.789Z",
  "build": "E123456",
  "Item": {
    "ItemID": "123456789012",
    "Title": "Brand New Laptop",
    "PrimaryCategory": {
      "CategoryID": "1234",
      "CategoryName": "Laptops & Netbooks"
    },
    "SecondaryCategory": [
      {
        "CategoryID": "5678",
        "CategoryName": "Apple Laptops"
      },
      {
        "CategoryID": "9012",
        "CategoryName": "Business Laptops"
      }
    ],
    "StartPrice": {
      "currencyID": "USD",
      "__value__": "999.99"
    },
    "CurrentPrice": {
      "currencyID": "USD",
      "__value__": "999.99"
    },
    "HighBidder": {
      "UserID": "bidder123",
      "UserName": "HighBidderUser"
    },
    "QuantitySold": "10",
    "ReservePrice": {
      "currencyID": "USD",
      "__value__": "0.00"
    },
    "BidCount": "20",
    "SellingStatus": {
      "CurrentPrice": {
        "currencyID": "USD",
        "__value__": "999.99"
      },
      "ConvertedCurrentPrice": {
        "currencyID": "USD",
        "__value__": "999.99"
      },
      "TimeLeft": "P3DT6H23M59S"
    },
    "ListingInfo": {
      "ListingDuration": "GTC",
      "ListingType": "FixedPriceItem",
      "StartTime": "2023-04-01T00:00:00.000Z",
      "EndTime": "2023-05-01T00:00:00.000Z",
      "QuantityAvailable": "5",
      "BestOfferEnabled": "false",
      "BuyItNowAvailable": "true",
      "ConversionType": "FixedPrice"
    },
    "PaymentMethods": "PayPal, CreditCard",
    "PaymentInfo": {
      "PayPalAccepted": "true",
      "PayPalEmail": "seller@example.com"
    },
    "ShippingInfo": {
      "ShippingServiceCost": {
        "currencyID": "USD",
        "__value__": "10.00"
      },
      "ShipToLocations": "US, CA",
      "ExpeditedShipping": "true",
      "OneDayShippingAvailable": "false",
      "HandlingTime": "1"
    },
    "Location": "United States",
    "PictureURL": "https://example.com/item-picture.jpg",
    "GalleryURL": "https://example.com/gallery-picture.jpg",
    "ViewItemURLForNaturalSearch": "https://www.ebay.com/itm/Brand-New-Laptop/123456789012",
    "Description": "This is a brand new laptop computer...",
    "Seller": {
      "UserID": "seller123",
      "UserName": "SellerUser",
      "FeedbackScore": "98.5",
      "PositiveFeedbackPercent": "99"
    },
    "ReturnsAccepted": "true",
    "ConditionID": "1000",
    "ConditionDisplayName": "Brand New",
    "IsMultiVariationListing": "false",
    "Variations": [
      // 如果商品有多个变体,这里会列出每个变体的信息
    ],
    "SKU": "LAPTOP-001",
    "MPN": "LNX-MNXB2",
    "Brand":