0

我们正在尝试使用 marketplace.walmartapis.com api 来批量列出项目,它正在为 xml 项目提要返回不受支持的媒体类型

我们正在使用 Perl 并且能够执行其他命令来更新库存和定价、检查订单、查找提要和 skus 等。令牌应该是好的,因为我们使用相同的令牌和第一个调用(项目库存)在尝试发送 xml 文件之前按预期工作。只有当我们尝试发送 xml 批处理文件时才会遇到问题。

我们假设问题出在标头/身份验证上,并尝试了许多不同的组合。但显然我们遗漏了一些东西。

发送的内容:

POST https://marketplace.walmartapis.com/v3/feeds?feedType=item HTTP/1.1

标题:

Authorization: Basic MDc4......
Content-Length: 2277
Accept: application/xml
Content-Type: multipart/formdata
Host: marketplace.walmartapis.com
WM_QOS.CORRELATION_ID: TB123456V32
WM_SEC.ACCESS_TOKEN: eyJra...
WM_SVC.NAME: Walmart Marketplace
Boundary: 1234ran4321dom5678boundary

表单数据有效负载:

--1234ran4321dom5678boundary
Content-Disposition: formdata; name="xml"
Content-length: 2151


<?xml version="1.0" encoding="UTF-8"?>
<MPItemFeed xmlns="http://walmart.com/">
  <MPItemFeedHeader>
    <version>3.1</version>
    <requestBatchId>......</requestBatchId>
    <feedDate>2019-02-18T19:45:17</feedDate>
    <mart>WALMART_US</mart>
  </MPItemFeedHeader>
  <MPItem>
    <processMode>CREATE</processMode>
    <sku>....</sku>
    <productIdentifiers>
      <productIdentifier>
        <productIdType>UPC</productIdType>
        <productId>..........</productId>
      </productIdentifier>
    </productIdentifiers>
    <MPProduct>
      <productName>.....................</productName>
      <category>
        <SportAndRecreation>
          <SportAndRecreationOther>
            <shortDescription>........................</shortDescription>
            <keyFeatures>
              <keyFeaturesValue>I...............</keyFeaturesValue>
            </keyFeatures>
            <brand>............</brand>
            <manufacturer>.............</manufacturer>
            <manufacturerPartNumber>.............</manufacturerPartNumber>
            <modelNumber>..</modelNumber>
            <mainImageUrl>............</mainImageUrl>
            <count>1</count>
            <isProp65WarningRequired>No</isProp65WarningRequired>
            <sportsLeague>
               <sportsLeagueValue>....</sportsLeagueValue>
            </sportsLeague>
            <keywords>................</keywords>
            <isMemorabilia>......</isMemorabilia>
            <isCollectible>...........</isCollectible>
          </SportAndRecreationOther>
        </SportAndRecreation>
      </category>
    </MPProduct>
    </MPOffer>
        <price>21.95</price>
        <StartDate>2019-02-23T19:45:17</StartDate>
        <EndDate>2019-04-19T19:45:17</EndDate>
        <ShippingWeight>
          <measure>2</measure>
          <unit>lb</unit>
        </ShippingWeight>
        <ProductTaxCode>2038345</ProductTaxCode>
    </MPOffer>
  </MPItem>
</MPItemFeed>
--1234ran4321dom5678boundary--

从沃尔玛回来。pm

$HASH = {
      "error" => {
                 "category" => "DATA",
                 "causes" => {},
                 "code" => "UNSUPPORTED_MEDIA_TYPE.GMP_GATEWAY_API",
                 "errorIdentifiers" => {},
                 "info" => "Unsupported Media Type.",
                 "severity" => "ERROR"
               },
      "xmlns:ns2" => "http://walmart.com/"
};

任何正确方向的指针将不胜感激。

4

1 回答 1

1

感谢所有看过的人。问题似乎解决了

这是一个小错字

multipart/formdata 需要是 multipart/form-data

现在有了这个改变,我们得到了一个显示在卖家区域的 feed id

于 2019-02-19T15:28:13.280 回答