调用易趣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>
我们正试图通过易趣API使用上述XML添加商品,但无法添加。我们在XML格式中做错了什么?此外,由于出现错误,我们添加了特定的数据。
添加ItemSpecifics
时,您需要检查是否有任何ItemSpecific
条目是您的CategoryID
所必需的。这可以从GetCategorySpecifics API进行检查。
在您的案例中,类别ID是176971
,在XML负载中,有两个现有的ItemSpecifics
:Brand
和MPN
。根据您从易趣上的GetCategorySpecifics
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>
添加Type
ItemSpecific后,可以使用VerifyAddItemResponse
API验证调用。
一般来说,要想弄清楚给定的CategoryId
需要什么ItemSpecifics,可以参考以下文档(列出所需的ItemSpecifics(。但是,非常简单地说,要确定需要哪些ItemSpecifics,请调用GetCategorySpecifics
来检索您列出的类别的ItemSpecifics建议。在回复中,为每个建议查找以下字段:
- 类别需要此项目特定名称:
Recommendations.NameRecommendation.ValidationRules.MinValues
- 您只能使用易趣定义的其中一个值(在回复中返回(:
Recommendations.NameRecommendation.ValidationRules.SelectionMode=SelectionOnly