Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails小贩gem:使用Amazon MWS提要API向Amazon卖家中心商店添加产品_Ruby On Rails_Amazon_Amazon Mws_Peddler - Fatal编程技术网

Ruby on rails Rails小贩gem:使用Amazon MWS提要API向Amazon卖家中心商店添加产品

Ruby on rails Rails小贩gem:使用Amazon MWS提要API向Amazon卖家中心商店添加产品,ruby-on-rails,amazon,amazon-mws,peddler,Ruby On Rails,Amazon,Amazon Mws,Peddler,我正在尝试使用amazon mws feeds api向amazon卖家帐户添加产品。我正在使用Ruby on Rails和peddler gem。但我找不到任何关于如何添加新产品的文档/示例。有一个函数用于提交提要()。但我不确定如何发送“feed_content”参数。有没有关于如何做的例子?我能够建立连接: client = MWS::Feeds::Client.new( marketplace_id: 'marketplace_id', merchant_id:

我正在尝试使用amazon mws feeds api向amazon卖家帐户添加产品。我正在使用Ruby on Rails和peddler gem。但我找不到任何关于如何添加新产品的文档/示例。有一个函数用于提交提要()。但我不确定如何发送“feed_content”参数。有没有关于如何做的例子?我能够建立连接:

  client = MWS::Feeds::Client.new(
  marketplace_id:        'marketplace_id',
  merchant_id:           'merchant_id',
  auth_token:            'auth_token',
  aws_access_key_id:     'aws_access_key_id',
  aws_secret_access_key: 'aws_secret_access_key'
)
请分享任何关于如何添加产品的示例或建议。提前感谢。

是提要本身的实际内容,无论是XML还是平面文件。你还需要一个新的。请查看以了解流程。无论您使用何种语言或平台,流程都是相同的

请求将如下所示:

POST /Feeds/2009-01-01 HTTP/1.1
Content-Type: x-www-form-urlencoded
Host: mws.amazonservices.com
User-Agent: <Your User Agent Header>

?AWSAccessKeyId=0PB842ExampleN4ZTR2
&Action=SubmitFeed
&FeedType=_POST_PRODUCT_DATA_
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
&MarketplaceIdList.Id.1=ATVExampleDER
&SellerId=A1XExample5E6
&ContentMD5Value=ExampleMd5HashOfHttpBodyAsPerRfc2616Example
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-01-26T23%3A51%3A31.315Z
&Version=2009-01-01
&Signature=SvSExamplefZpSignaturex2cs%3D
<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
  <Header>
    <DocumentVersion>1.01</DocumentVersion>
    <MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
  </Header>
  <MessageType>Product</MessageType>
  <PurgeAndReplace>false</PurgeAndReplace>
  <Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Product>
      <SKU>56789</SKU>
      <StandardProductID>
        <Type>ASIN</Type>
        <Value>B0EXAMPLEG</Value>
      </StandardProductID>
      <ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
      <DescriptionData>
        <Title>Example Product Title</Title>
        <Brand>Example Product Brand</Brand>
        <Description>This is an example product description.</Description>
        <BulletPoint>Example Bullet Point 1</BulletPoint>
        <BulletPoint>Example Bullet Point 2</BulletPoint>
        <MSRP currency="USD">25.19</MSRP>
        <Manufacturer>Example Product Manufacturer</Manufacturer>
        <ItemType>example-item-type</ItemType>
      </DescriptionData>
      <ProductData>
        <Health>
          <ProductType>
            <HealthMisc>
              <Ingredients>Example Ingredients</Ingredients>
              <Directions>Example Directions</Directions>
            </HealthMisc>
          </ProductType>
        </Health>
      </ProductData>
    </Product>
  </Message>
</AmazonEnvelope>
POST/Feeds/2009-01-01 HTTP/1.1
内容类型:x-www-form-urlencoded
主持人:mws.amazonservices.com
用户代理:
?AWSAccessKeyId=0PB842示例4ZTR2
&动作=提交
&FeedType=\发布\产品\数据_
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87AEE示例
&MarketplaceIdList.Id.1=ATVExampleDER
&SellerId=A1XExample5E6
&ContentMD5Value=ExampleMd5HashOfHttpBodyAsperFC2616示例
&SignatureMethod=HmacSHA256
&SignatureReversion=2
&时间戳=2009-01-26T23%3A51%3A31.315Z
&版本=2009-01-01
&签名=SvSExamplefZpSignaturex2cs%3D
主体(包含您添加的产品)如下所示:

POST /Feeds/2009-01-01 HTTP/1.1
Content-Type: x-www-form-urlencoded
Host: mws.amazonservices.com
User-Agent: <Your User Agent Header>

?AWSAccessKeyId=0PB842ExampleN4ZTR2
&Action=SubmitFeed
&FeedType=_POST_PRODUCT_DATA_
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
&MarketplaceIdList.Id.1=ATVExampleDER
&SellerId=A1XExample5E6
&ContentMD5Value=ExampleMd5HashOfHttpBodyAsPerRfc2616Example
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-01-26T23%3A51%3A31.315Z
&Version=2009-01-01
&Signature=SvSExamplefZpSignaturex2cs%3D
<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
  <Header>
    <DocumentVersion>1.01</DocumentVersion>
    <MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
  </Header>
  <MessageType>Product</MessageType>
  <PurgeAndReplace>false</PurgeAndReplace>
  <Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Product>
      <SKU>56789</SKU>
      <StandardProductID>
        <Type>ASIN</Type>
        <Value>B0EXAMPLEG</Value>
      </StandardProductID>
      <ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
      <DescriptionData>
        <Title>Example Product Title</Title>
        <Brand>Example Product Brand</Brand>
        <Description>This is an example product description.</Description>
        <BulletPoint>Example Bullet Point 1</BulletPoint>
        <BulletPoint>Example Bullet Point 2</BulletPoint>
        <MSRP currency="USD">25.19</MSRP>
        <Manufacturer>Example Product Manufacturer</Manufacturer>
        <ItemType>example-item-type</ItemType>
      </DescriptionData>
      <ProductData>
        <Health>
          <ProductType>
            <HealthMisc>
              <Ingredients>Example Ingredients</Ingredients>
              <Directions>Example Directions</Directions>
            </HealthMisc>
          </ProductType>
        </Health>
      </ProductData>
    </Product>
  </Message>
</AmazonEnvelope>

1.01
M_示例_123456
产品
假的
1.
更新
56789
阿辛
B0EXAMPLEG
A_GEN_NOTAX
产品名称示例
示例产品品牌
这是一个产品描述示例。
示例要点1
示例要点2
25.19
示例产品制造商
示例项目类型
示例成分
示例说明

你好,斯科特,谢谢你的回复。这真的很有帮助。我还有几个问题:在浏览了mws文档之后,对于一些提要,没有可用的xml模式。那么我们如何为这些提要创建一个xml文件呢?对于某些提要,xsd是可用的,那么我们如何从这些xsd创建xml呢?这些可能是一些新手问题,因为我对web开发还不熟悉。你可以在这里找到xsd:我不是ruby程序员,所以我不知道是否有像我为C#准备的工具。在StackOverflow上进行搜索,您一定会找到一些内容。感谢您的回复:)