ebay-api - 由于缺少项目特定类型,无法在 eBay API 上添加项目
问题描述
调用 eBay AddItemRequest
API时出现以下错误
缺少项目特定类型。将类型添加到此列表中,输入有效值,然后重试。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 格式中做错了什么?此外,由于出现错误,我们添加了特定数据。
解决方案
添加时ItemSpecifics
,您需要检查是否有任何ItemSpecific
条目对您的CategoryID
. 这可以从GetCategorySpecifics API 检查。
在您的情况下,类别 ID 是176971
并且在 XML 有效负载中,有两个现有的ItemSpecifics
:Brand
和MPN
. 正如您从GetCategorySpecifics
eBay 上的 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
推荐阅读
- html - Outlook 预览功能通过 HTML 代码错误地显示符号
- python - FastAPI - 未填充 ENUM 类型模型
- javascript - 将文件选择器数据存储在隐藏的输入中
- discord - 通过服务器昵称上的表情符号接收角色
- python - Selenium Python:预期“句柄”是一个字符串,得到 [object Undefined] undefined
- vector - “向上”向量和 y 轴有什么区别?
- recover - 我正在用 C 编写一个用于 CS50x Pset 4 Recover 的程序。在我读取第一个块然后尝试编写它之后,我收到一个分段错误
- python - URL解析:获取N个文件夹,后跟从某个文件夹开始的文件名
- asp.net-core - 如何在 ASP.NET Core MVC 3.1 中本地化 LoginPath
- reactjs - Firebase:使用字符串引用文档与使用 ref 引用文档。有区别吗?