首页 > 解决方案 > 由于缺少项目特定类型,无法在 eBay API 上添加项目

问题描述

调用 eBay AddItemRequestAPI时出现以下错误

缺少项目特定类型。将类型添加到此列表中,输入有效值,然后重试。21919303

<?xml version="1.0" encoding="utf-8"?>
<AddItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>XXXXXXXXXXX</eBayAuthToken>
  </RequesterCredentials>
  <ErrorLanguage>en_US</ErrorLanguage>
  <WarningLevel>High</WarningLevel>
  <Item>
    <Title>test-800</Title>
    <Description>test 800</Description>
    <PrimaryCategory>
      <CategoryID>176971</CategoryID>
    </PrimaryCategory>
    <StartPrice>200</StartPrice>
    <CategoryMappingAllowed>true</CategoryMappingAllowed>
    <ConditionID>1000</ConditionID>
    <Country>US</Country>
    <Currency>USD</Currency>
    <DispatchTimeMax>3</DispatchTimeMax>
    <ListingDuration>GTC</ListingDuration>
    <ListingType>FixedPriceItem</ListingType>
    <PictureDetails>
      <GalleryType>Gallery</GalleryType>
      <PictureURL>https://eznetcrm.net/img/eZnetLogo.png</PictureURL>
    </PictureDetails>
    <PostalCode>32746</PostalCode>
    <ProductListingDetails>
      <UPC></UPC>
      <BrandMPN>
        <Brand>HP</Brand>
        <MPN>845418-B21</MPN>
      </BrandMPN>
      <IncludeStockPhotoURL>true</IncludeStockPhotoURL>
      <IncludePrefilledItemInformation>true</IncludePrefilledItemInformation>
      <UseFirstProduct>true</UseFirstProduct>
      <UseStockPhotoURLAsGallery>true</UseStockPhotoURLAsGallery>
      <ReturnSearchResultOnDuplicates>true</ReturnSearchResultOnDuplicates>
    </ProductListingDetails>
    <Quantity>5</Quantity>
    <ItemSpecifics>
      <NameValueList>
<Name>Brand</Name>
<Value>HP</Value>
  </NameValueList>
  <NameValueList>
<Name>MPN</Name>
<Value>845418-B21</Value>
  </NameValueList>
    </ItemSpecifics>
    <ReturnPolicy>
      <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
      <RefundOption>MoneyBack</RefundOption>
      <ReturnsWithinOption>Days_30</ReturnsWithinOption>
      <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption>
    </ReturnPolicy>
    <ShippingDetails>
      <ShippingType>Flat</ShippingType>
      <ShippingServiceOptions>
        <ShippingServicePriority>1</ShippingServicePriority>
        <ShippingService>USPSMedia</ShippingService>
       <ShippingServiceAdditionalCost>0</ShippingServiceAdditionalCost>
        <ShippingServiceCost>0</ShippingServiceCost>
      </ShippingServiceOptions>
    </ShippingDetails>
    <Site>US</Site>
  </Item>
</AddItemRequest>

我们正在尝试通过 eBay API 使用上述 XML 添加项目,但无法这样做。我们在 XML 格式中做错了什么?此外,由于出现错误,我们添加了特定数据。

标签: ebay-apiebay-sdkebay-lms

解决方案


添加时ItemSpecifics,您需要检查是否有任何ItemSpecific条目对您的CategoryID. 这可以从GetCategorySpecifics API 检查。

在您的情况下,类别 ID 是176971并且在 XML 有效负载中,有两个现有的ItemSpecifics:BrandMPN. 正如您从GetCategorySpecificseBay 上的 API 获得并确认的错误消息所建议的那样,很明显您需要在 ItemSpecifics 中添加一个带有名称Type的 ItemSpecific。完成后,您ItemSpecifics应该如下所示:

  <ItemSpecifics>
     <NameValueList>
        <Name>Brand</Name>
        <Value>HP</Value>
     </NameValueList>

     <NameValueList>
        <Name>Type</Name>
        <Value>CustomTypeNameHere</Value>
     </NameValueList>

     <NameValueList>
        <Name>MPN</Name>
        <Value>845418-B21</Value>
     </NameValueList>
  </ItemSpecifics>

添加ItemSpecificVerifyAddItemResponse后,您可以使用 API验证调用。Type

一般来说,要弄清楚给定的 ItemSpecifics 需要什么CategoryId,您可以参考以下文档(Listing with Required Item Specifications。但是,非常简单地说,要确定需要哪些项目细节,请调用GetCategorySpecifics以检索项目细节的建议您列出的类别。在响应中,为每个建议查找以下字段:

  • 类别需要此项目特定名称:Recommendations.NameRecommendation.ValidationRules.MinValues
  • 您只能使用 eBay 定义的这些值之一(如响应中返回的):Recommendations.NameRecommendation.ValidationRules.SelectionMode=SelectionOnly

推荐阅读