eBay NVP api 返回失败

发布于 2024-11-25 18:27:54 字数 2104 浏览 1 评论 0原文

谁能告诉我为什么这个请求总是失败返回。当我添加 itemFilter(1).name=Seller&itemFilter(1).value(0)=sellerName 时,它​​才开始发生

。当我将其取出时,它工作正常。我知道当我取回数据时我可以解析出该信息,但这只是一种解决方法。

http://svcs.ebay.com/services/search/FindingService/v1
?OPERATION-NAME=findCompletedItems
&SERVICE-VERSION=1.0.0
&SECURITY-APPNAME=MY TOKEN HERE
&GLOBAL-ID=EBAY-US
&keywords=iphone+3gs+8gb
&categoryId=9355
&outputSelector=SellerInfo
&itemFilter(0).name=Condition
&itemFilter(0).value(0)=3000
&itemFilter(1).name=Seller
&itemFiler(1).value(0)=sellerName

这是我提出该请求时得到的结果:

<?xml version='1.0' encoding='UTF-8'?>
<findCompletedItemsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <ack>Failure</ack>
  <errorMessage>
    <error>
      <errorId>46</errorId>
      <domain>Marketplace</domain>
      <severity>Error</severity>
      <category>Request</category>
      <message>Value is required for item filter, SELLER.</message>
      <subdomain>Search</subdomain>
      <parameter>SELLER</parameter>
    </error>
  </errorMessage>
  <version>1.11.0</version>
  <timestamp>2011-07-23T00:13:50.689Z</timestamp>
</findCompletedItemsResponse>

它不断告诉我没有为 itemFilter.name=Seller 设置值。我也尝试了相同的请求,但添加了另一个 itemFilter.value(1)=sellerName2

这是当我尝试该请求时它给我的:

<?xml version='1.0' encoding='UTF-8'?>
<errorMessage xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <error>
    <errorId>5006</errorId>
    <domain>CoreRuntime</domain>
    <severity>Error</severity>
    <category>System</category>
    <message>Unable to create xml stream reader for NV: payload format incorrect or payload is empty</message>
    <subdomain>Comm_Recv</subdomain>
    <parameter name="Param1">NV</parameter>
  </error>
</errorMessage>

Can anyone please tell me why this request keeps returning with failure. It only started happening when I added itemFilter(1).name=Seller&itemFilter(1).value(0)=sellerName

When I take that out, it works fine. I know I can just parse out that information when I get the data back, but that's just a hack-workaround.

http://svcs.ebay.com/services/search/FindingService/v1
?OPERATION-NAME=findCompletedItems
&SERVICE-VERSION=1.0.0
&SECURITY-APPNAME=MY TOKEN HERE
&GLOBAL-ID=EBAY-US
&keywords=iphone+3gs+8gb
&categoryId=9355
&outputSelector=SellerInfo
&itemFilter(0).name=Condition
&itemFilter(0).value(0)=3000
&itemFilter(1).name=Seller
&itemFiler(1).value(0)=sellerName

Here's what I get when I make that request:

<?xml version='1.0' encoding='UTF-8'?>
<findCompletedItemsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <ack>Failure</ack>
  <errorMessage>
    <error>
      <errorId>46</errorId>
      <domain>Marketplace</domain>
      <severity>Error</severity>
      <category>Request</category>
      <message>Value is required for item filter, SELLER.</message>
      <subdomain>Search</subdomain>
      <parameter>SELLER</parameter>
    </error>
  </errorMessage>
  <version>1.11.0</version>
  <timestamp>2011-07-23T00:13:50.689Z</timestamp>
</findCompletedItemsResponse>

It keeps telling me that I don't have a value set for itemFilter.name=Seller. I also tried the same request but added another itemFilter.value(1)=sellerName2

This is what it gives me when I tried that request:

<?xml version='1.0' encoding='UTF-8'?>
<errorMessage xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <error>
    <errorId>5006</errorId>
    <domain>CoreRuntime</domain>
    <severity>Error</severity>
    <category>System</category>
    <message>Unable to create xml stream reader for NV: payload format incorrect or payload is empty</message>
    <subdomain>Comm_Recv</subdomain>
    <parameter name="Param1">NV</parameter>
  </error>
</errorMessage>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉生梦死 2024-12-02 18:27:54

由于您没有为每个项目使用多个值,因此它会失败。您当前的方式仅在每个项目存在多个值时进行评估,因此请尝试以下操作:

http://svcs.ebay.com/services/search/FindingService/v1
?OPERATION-NAME=findCompletedItems
&SERVICE-VERSION=1.0.0
&SECURITY-APPNAME=MY TOKEN HERE
&GLOBAL-ID=EBAY-US
&keywords=iphone+3gs+8gb
&categoryId=9355
&outputSelector=SellerInfo
&itemFilter(0).name=Condition
&itemFilter(0).value=3000
&itemFilter(1).name=Seller
&itemFiler(1).value=sellerName

大多数程序员在其代码中使用诸如 (this) 之类的内容:

     if(is_array($value)) {
        foreach($value as $j => $content) { // Index the key for each value
          $urlfilter .= "&itemFilter($i).$key($j)=$content";
        }
      }
      else {
        if($value != "") {
          $urlfilter .= "&itemFilter($i).$key=$value";
        }

Since you are not using multiple values per item it fails. Your current way only will evaluate when multiple values per item are present therefore try this:

http://svcs.ebay.com/services/search/FindingService/v1
?OPERATION-NAME=findCompletedItems
&SERVICE-VERSION=1.0.0
&SECURITY-APPNAME=MY TOKEN HERE
&GLOBAL-ID=EBAY-US
&keywords=iphone+3gs+8gb
&categoryId=9355
&outputSelector=SellerInfo
&itemFilter(0).name=Condition
&itemFilter(0).value=3000
&itemFilter(1).name=Seller
&itemFiler(1).value=sellerName

Most Programmers use something such as (this) in their code:

     if(is_array($value)) {
        foreach($value as $j => $content) { // Index the key for each value
          $urlfilter .= "&itemFilter($i).$key($j)=$content";
        }
      }
      else {
        if($value != "") {
          $urlfilter .= "&itemFilter($i).$key=$value";
        }
拥抱没勇气 2024-12-02 18:27:54

尝试

$params = http_build_query($your_array)

您还可以在 PHP 中

You can also try

$params = http_build_query($your_array)

in PHP

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文