草庐IT

php - Amazon MWS Api SubmitFeed _POST_FLAT_FILE_INVLOADER_DATA_ incorrect template type 错误

coder 2023-12-31 原文

我正在使用亚马逊 MWS PHP MarketplaceWebService PHP API 向亚马逊提交库存数据。

https://docs.developer.amazonservices.com/en_US/feeds/Feeds_SubmitFeed.html

我可以通过卖家中心上传库存 gui 手动提交生成的库存加载程序平面文件, 不会出错。

使用 API 中的 SubmitFeed 示例提交相同的平面文件时,我总是收到“不正确的模板类型错误”。

我的身份验证和市场数据都是正确的。

提要数据在 $_feed 中,我正在使用 api 从 api 创建提要数据流

$feedHandle = fopen('php://temp', 'rw+');
fwrite($feedHandle, $_feed);
rewind($feedHandle);

并使用亚马逊的示例代码提交

$marketplaceIdArray = array("Id" => array(MARKETPLACE_ID));


$parameters = array (
  'Merchant' => MERCHANT_ID,
  'MarketplaceIdList' => $marketplaceIdArray,
  'FeedType' => '_POST_FLAT_FILE_INVLOADER_DATA_',
  'FeedContent' => $feedHandle,
  'PurgeAndReplace' => false,
  'ContentMd5' => base64_encode(md5(stream_get_contents($feedHandle), true)),
);

rewind($feedHandle);

$request = new \MarketplaceWebService_Model_SubmitFeedRequest($parameters);

$_result=$this->invokeSubmitFeed($service, $request);

Feed 提交没有错误,但是当我检查提交状态时,我总是从亚马逊收到错误的模板类型错误。

如果我将提要数据写入一个单独的文件,或者获取流的副本并将其写入测试文件,例如

// TEST copy submitted file to temp file
$copystream = fopen('/copystream.txt', 'w');
stream_copy_to_stream($streamHandle, $copystream);

我可以确认亚马逊 MWS API curl 上传(在 client.php 中)使用的数据是正确的,因为我也可以通过卖家中心手动上传此测试文件 (copystream.txt) 而不会出现错误。

此问题类似于此处发布的问题 https://sellercentral.amazon.com/forums/message.jspa?messageID=2914605从 2014 年开始,这表明通过 API 发布时使用的平面文件 header 与通过亚马逊卖家中心上传平面文件时使用的不同。

我正在使用来自 Amazon 的默认示例模板中的 header 用于美容类别:

TemplateType=beauty Version=2016.0324   The top 3 rows are for Amazon.com use only. Do not modify or delete the top 3 rows.                             Offer-Offer Information - These attributes are required to make your item buyable for customers on the site.                                                                    Dimensions-Product Dimensions - These attributes specify the size and weight of a product.                                                      Discovery-Item discovery information - These attributes have an effect on how customers can find your product on the site using browse or search.                           Images-Image Information - See Image Instructions tab for details.                  Fulfillment-Use these columns to provide fulfilment-related information for orders fulfilled either by Amazon (FBA) or by the Seller.   Variation-Variation information - Populate these attributes if your product is available in different variations (for example colour or wattage).               Ungrouped - These attributes create rich product listings for your buyers.                                                      
    Seller SKU  Item Name (aka Title)   Product Type    Product ID  Product ID Type Brand Name  Manufacturer    Manufacturer Part Number    Product Description Update Delete   Standard Price  Quantity    Fulfillment Latency Package Quantity    Number of Items Launch Date Release Date    Is Discontinued by Manufacturer Sale Price  Sale From Date  Sale End Date   Max Order Quantity  Max Aggregate Ship Quantity Can Be Gift Messaged    Is Gift Wrap Available? Product Tax Code    Merchant Shipping Group Item Display Weight Unit Of Measure Display Weight  Item Display Volume Unit Of Measure Display Volume  Display Length  Item Display Length Unit Of Measure Item Weight Unit Of Measure Item Weight Item Length Unit Of Measure Item Length Item Width  Item Height Website Shipping Weight Unit Of Measure Shipping Weight Recommended Browse Nodes    Key Product Features    Key Product Features    Key Product Features    Key Product Features    Key Product Features    Search Terms    Main Image URL  Swatch Image URL    Other Image URL Other Image URL Other Image URL Fulfillment Centre ID   Parentage   Parent SKU  Relationship Type   Variation Theme Ingredients Material Type   Item Form   Is Adult Product    Target Gender   Skin Type   Hair Type   Indications Directions  Size    Colour  Colour Map  Scent   Sun Protection Factor   Medicine Classification
    item_sku    item_name   feed_product_type   external_product_id external_product_id_type    brand_name  manufacturer    part_number product_description update_delete   standard_price  quantity    fulfillment_latency item_package_quantity   number_of_items product_site_launch_date    merchant_release_date   is_discontinued_by_manufacturer sale_price  sale_from_date  sale_end_date   max_order_quantity  max_aggregate_ship_quantity offering_can_be_gift_messaged   offering_can_be_giftwrapped product_tax_code    merchant_shipping_group_name    item_display_weight_unit_of_measure item_display_weight item_display_volume_unit_of_measure item_display_volume item_display_length item_display_length_unit_of_measure item_weight_unit_of_measure item_weight item_length_unit_of_measure item_length item_width  item_height website_shipping_weight_unit_of_measure website_shipping_weight recommended_browse_nodes    bullet_point1   bullet_point2   bullet_point3   bullet_point4   bullet_point5   generic_keywords    main_image_url  swatch_image_url    other_image_url1    other_image_url2    other_image_url3    fulfillment_center_id   parent_child    parent_sku  relationship_type   variation_theme ingredients material_type   item_form   is_adult_product    target_gender   skin_type   hair_type   indications directions  size_name   color_name  color_map   scent_name  sun_protection  medicine_classification

最佳答案

根据

http://docs.developer.amazonservices.com/en_US/feeds/Feeds_FeedType.html#FeedType_Enumeration__ProductInventoryFeeds

Feed 类型_POST_FLAT_FILE_INVLOADER_DATA_ 的模板文件与亚马逊卖家中心可供下载的模板不同,即使 api 将 _POST_FLAT_FILE_INVLOADER_DATA_ 报告为手动卖家中央库存文件上传所使用的 Feed 类型.将这些模板之一与 _POST_FLAT_FILE_INVLOADER_DATA_ 一起使用会导致 Amazon API 返回模板错误。

解决方案是使用接受标准卖家中心模板的 feed 类型 _POST_FLAT_FILE_LISTINGS_DATA_

关于php - Amazon MWS Api SubmitFeed _POST_FLAT_FILE_INVLOADER_DATA_ incorrect template type 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39289735/

有关php - Amazon MWS Api SubmitFeed _POST_FLAT_FILE_INVLOADER_DATA_ incorrect template type 错误的更多相关文章

随机推荐