无法使用eBay API更新列表说明

时间:2019-02-25 10:06:06

标签: perl ebay-api

我正在尝试编写一个 Perl 脚本,该脚本将更新我们的 eBay列表说明,而不必保持登录状态(如果事实证明要保持存货比较棘手,则可以跨多个市场运行)级别,说明等已更新)。这是我到目前为止的内容:

 my $ebay = new Net::eBay( {
                              SiteLevel => 'prod',
                              DeveloperKey => 'x',
                              ApplicationKey => 'x',
                              CertificateKey => 'x',
                              Token => 'x',
                             } );

  $ebay->setDefaults( { API => 2, compatibility => 900  } );

my $new_desc = q|<meta name="viewport" content="width=device-width, initial-scale=1.0">
<p>We are proud to announce our first ever badge! With an easy-to-iron
on backing, fitting couldn't be any easier! We have designed the path to
 be a perfect addition to any piece of cosplay costume.&nbsp; Please do send
in the photos of it being used on your costumes, as we would love to
share.</p>
<p>The badge is 7 x 7 cm / 2 x 2 inches in size, and 2mm thi<br></p>|;

my $result = $ebay->submitRequest( "ReviseItem",
                      {
                       DetailLevel => "ReturnAll",
                       ErrorLevel => "1",
                       SiteId => "1",
                       Item => {
                         Description => \$new_desc,
                         ItemID => 253430606975
                       },
                       ItemID => 253430606975
                      }) || die;

 print "Result: " . Dumper( $result ) . "\n";

虽然运行时出现错误:

      'Errors' => [
                  {
                    'ShortMessage' => 'Return Policy Attribute Not Valid',
                    'ErrorClassification' => 'RequestError',
                    'ErrorCode' => '21920200',
                    'LongMessage' => 'Return Policy Attribute returnDescription Not Valid On This Site',
                    'SeverityCode' => 'Warning',
                    'ErrorParameters' => {
                                         'Value' => 'returnDescription',
                                         'ParamID' => '0'
                                       }
                  },
                  {
                    'ShortMessage' => 'Description is missing.',
                    'ErrorClassification' => 'RequestError',
                    'ErrorCode' => '106',
                    'SeverityCode' => 'Error',
                    'LongMessage' => 'A description is required.'
                  }
                ],

我误会了什么?据我了解,您只是传递要更改的参数?

更新:根据Dave的建议,我正在试用 Marketplace :: Ebay 。通过尝试选择我的一项来进行测试:

 my $ebay = Marketplace::Ebay->new(
                                  production => 1,
                                  site_id => 3,
                                  developer_key => 'xx',
                                  application_key => 'xx',
                                  certificate_key => 'xxx',
                                  token => 'xx',
                                  xsd_file => 'ebaySvc.xsd',
                                 );

my $res = $ebay->api_call('GetItem', { ItemID => 253430606975 });
print Dumper($res);

但是我收到一些奇怪的错误:

  

错误:元素“ {urn:ebay:apis:eBLBaseComponents} GiftIcon”不正确   为{urn:ebay:apis:eBLBaseComponents} GetItemResponse / Item处理   / / [5] / * [6] $ VAR1 = undef;

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

啊哈-知道了!这个问题似乎与HTML传递的方式有关。如果我将其放在<asp:TemplateField HeaderText="Nature"> <ItemTemplate> <asp:HyperLink Target="_blank" ID="nature" NavigateUrl='<%# stauslink_RowDataBound(Eval("nature") as string) %>' Text='<%# Eval("nature") %>' Visible='<%# !string.IsNullOrEmpty(stauslink_RowDataBound(Eval("nature") as string)) %>' runat="server" /> <asp:Literal ID="Literal1" runat="server" Text='<%# Eval("nature") %>' Visible='<%# string.IsNullOrEmpty(stauslink_RowDataBound(Eval("nature") as string)) %>'></asp:Literal> </ItemTemplate> </asp:TemplateField> 标记中,则效果很好:

CDATA

...并且完美更新