developers program  

Welcome, Guest Help
Login Login | Register
 

eBay Developer Forums > Technical Questions: eBay Shopping, Finding and Merchandising APIs
RSS | NNTP Reader | FAQ | Usage Policies | Advanced Search | Print

in current forum  
in all Developer Forums

Replies: 4 - Pages: 1     Last Post: Nov 22, 2009 11:20 PM by: aneesh9895412020 »



Posts: 19
Member Since: 11/10/09



How to use findItemsIneBayStores-finding API
Posted: Nov 17, 2009 3:15 AM
  Click to reply to this thread Reply

Hi,

I have to implement the finding API. I have tried to implement it,but with no success.

<?php

error_reporting(E_ALL); // Turn on all errors, warnings and notices for easier debugging

// API request variables
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1'; // URL to call
$version = '1.0.0'; // API version supported by your application
$appid = ''; // Replace with your own AppID
$globalid = 'EBAY-GB'; // Global ID of the eBay site you want to search (e.g., EBAY-DE)
$query = 'BMW'; // You will need to supply your own query
$SafeQuery = urlencode($query); // Make the query URL-friendly
$storenname = 'xyz'; // Initialize the item filter index array to 0
$i = '0'; // Initialize the item filter index array to 0


$filterArray =
array(
array(
'name' => 'MaxPrice',
'value' => '250',
'paramName' => 'Currency',
'paramValue' => 'GBP'),
array(
'name' => 'FreeShippingOnly',
'value' => 'false',
'paramName' => '',
'paramValue' => ''),

);

// Build item filters URL array
function buildURLArray ($filterArray) {
global $urlfilter;
global $i;
// Iterate through each filter in the array
foreach($filterArray as $itemFilter) {
// Iterate through each key in the filter
foreach ($itemFilter as $key =>$value) {
$r = '0'; //A number that increments each time the above "for" loops;
if(is_array($value)) { //if the 'value' var content is an array
if($value != "") { //check to make sure the content isn't empty
foreach($value as $j => $content) {
$urlfilter .= "&itemFilter($i).$key($j)=$content";
}
}
}
else { //this isnt an array so just print the single contents of the 'value' container, no indexing of keys needed
if($value != "") {
$urlfilter .= "&itemFilter($i).$key=$value";
}
}
$r++;
}
$i++;
}
return "$urlfilter";
} // End of buildURLArray function

buildURLArray($filterArray);

// Construct the findItemsByKeywords call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsIneBayStores";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&RESPONSE-DATA-FORMAT=XML";
$apicall .= "&REST-PAYLOAD";


$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&storeName=$storenname";
$apicall .= "&outputSelector=StoreInfo";



$apicall .= "$urlfilter";
$apicall .= "&paginationInput.entriesPerPage=1";
$apicall .= "&keywords=$SafeQuery";


// Load the call and capture the document returned by eBay API
$resp = simplexml_load_file($apicall);

print_r($resp);


but while printing the rseult I am getting

SimpleXMLElement Object ( [ack] => Success [version] => 1.1.0 [timestamp] => 2009-11-17T11:10:36.349Z [searchResult] => SimpleXMLElement Object ( [@attributes] => Array ( [count] => 0 ) ) [paginationOutput] => SimpleXMLElement Object ( [pageNumber] => 0 [entriesPerPage] => 1 [totalPages] => 0 [totalEntries] => 0 ) )

where have I gone wrong.
Some one please help me out. I am really stuck over here

Thanks
Aneesh.V.K




Posts: 82
Member Since: 10/4/09



Re: How to use findItemsIneBayStores-finding API
Posted: Nov 17, 2009 1:28 PM
  Click to reply to this thread Reply

set the storename variable




Posts: 19
Member Since: 11/10/09



Re: How to use findItemsIneBayStores-finding API
Posted: Nov 17, 2009 10:39 PM
  Click to reply to this thread Reply

Thanks for the reply... i was able to make the call work this the working call


<?php
error_reporting(E_ALL); // Turn on all errors, warnings and notices for easier debugging
// API request variables $endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1';  // URL to call
$version = '1.1.0'; // API version supported by your application
$appid = 'Your appid'; // Replace with your own AppID
$globalid = 'EBAY-GB'; // Global ID of the eBay site you want to search (e.g., EBAY-DE)
$query = 'BMW'; // You will need to supply your own query
$SafeQuery = urlencode($query); // Make the query URL-friendly
$storenname = 'your store name';
$i = '0'; // Initialize the item filter index array to 0
$filterArray = array( array( 'name' => 'MaxPrice', 'value' => '250', 'paramName' => 'Currency', 'paramValue' => 'GBP'), array( 'name' => 'FreeShippingOnly', 'value' => 'false', 'paramName' => '', 'paramValue' => ''), ); // Build item filters URL array function buildURLArray ($filterArray) { global $urlfilter; global $i; // Iterate through each filter in the array foreach($filterArray as $itemFilter) { // Iterate through each key in the filter foreach ($itemFilter as $key =>$value) { $r = '0'; //A number that increments each time the above "for" loops; if(is_array($value)) { //if the 'value' var content is an array if($value != "") { //check to make sure the content isn't empty foreach($value as $j => $content) { $urlfilter .= "&itemFilter($i).$key($j)=$content"; } } } else { //this isnt an array so just print the single contents of the 'value' container, no indexing of keys needed if($value != "") { $urlfilter .= "&itemFilter($i).$key=$value"; } } $r++; } $i++; } return "$urlfilter"; } // End of buildURLArray function buildURLArray($filterArray); // Construct the findItemsByKeywords call $apicall = "$endpoint?"; $apicall .= "OPERATION-NAME=findItemsIneBayStores"; $apicall .= "&SERVICE-VERSION=$version"; $apicall .= "&SECURITY-APPNAME=$appid"; $apicall .= "&RESPONSE-DATA-FORMAT=XML"; $apicall .= "&REST-PAYLOAD"; $apicall .= "&GLOBAL-ID=$globalid"; $apicall .= "&storeName=$storenname"; $apicall .= "&outputSelector=StoreInfo"; $apicall .= "$urlfilter"; $apicall .= "&paginationInput.entriesPerPage=4"; //echo $apicall."
"; // Load the call and capture the document returned by eBay API $resp = simplexml_load_file($apicall); print_r($resp); // Check to see if the response was loaded, else print an error if ($resp) { $results = ''; // If the response was loaded, parse it and build links foreach($resp->searchResult->item as $item) { $pic = $item->galleryURL; $link = $item->viewItemURL; $title = $item->title; // For each SearchResultItem node, build a link and append it to $results $results .= "<tr><td></td><td>$title</td></tr>"; foreach($item->sellingStatus as $sellingStatus) { $priceOfMoreItems = $sellingStatus->currentPrice; } } } // If there was no response, print an error else { $results = "Oops! Must not have gotten the response!"; } ?>



But now I have got another issue. This call only returns 100 items. I have to get about 2000 items. How can I do that.Is there any other methods for getting all the items from a store


Thanks Aneesh




Posts: 492
Member Since: 4/27/09



Re: How to use findItemsIneBayStores-finding API
Posted: Nov 20, 2009 1:58 PM
  Click to reply to this thread Reply

Hi aneesh9895412020,

You question is answered here:

http://dev-forums.ebay.com/thread.jspa?forumID=1007&threadID=500014879

Best Regards,
Prafull Jha
eBay Developers Program




Posts: 19
Member Since: 11/10/09



Re: How to use findItemsIneBayStores-finding API
Posted: Nov 22, 2009 11:20 PM
  Click to reply to this thread Reply

Hi Praful,

I am having an issue with this method. I tested the call with a store name and it works fine. The return has items in it. But when I change the store name to some other name, it is not working. Its showing success but the search result count is zero.

I tested the call using DIGI-FLEX UK and it worked.
but when i give The Light Bulb Company or STYLYZE Car Lighting as store name the search result count returned is 0.

Can you please clarify this.

the url generated is

http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsIneBayStores &SERVICE-VERSION=1.1.0 &SECURITY-APPNAME=your app id &RESPONSE-DATA-FORMAT=XML &REST-PAYLOAD &GLOBAL-ID=EBAY-GB &storeName=your store name &outputSelector=StoreInfo &itemFilter(0).name=MaxPrice&itemFilter(0).value=250 &itemFilter(0).paramName=Currency &itemFilter(0).paramValue=GBP &paginationInput.entriesPerPage=10



thread.rss_message