Vitaliy Isikov
Vitaliy Isikov

Reputation: 3654

eBay NVP api returning failure

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>

Upvotes: 2

Views: 2627

Answers (2)

hitwill
hitwill

Reputation: 623

You can also try

$params = http_build_query($your_array)

in PHP

Upvotes: 0

Haso Keric
Haso Keric

Reputation: 271

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";
        }

Upvotes: 3

Related Questions