Note that there are some explanatory texts on larger screens.

plurals
  1. POeBay FindingAPI - findItemsByProduct, PHP
    primarykey
    data
    text
    <p>I'm trying to integrate eBay API in my project. I use ZendFramework and there is library for eBay FindingAPI, but it doesn't work for method 'findItemsByProduct'.</p> <p>For understanding problem i wrote my small class:</p> <pre><code>&lt;?php class MyProject_Model_Ebay { const FINDING_API_URL = 'http://svcs.ebay.com/services/search/FindingService/v1?'; private $appId; public function __construct($appId) { $this-&gt;appId = $appId; } public function findByProduct($id, $type = 'UPC') { $params = array( 'productId.@type' =&gt; $type, 'productId' =&gt; $id, ); return $this-&gt;doApiRequest('findItemsByProduct', $params); } public function findByKeywords($keywords) { $params = array( 'keywords' =&gt; $keywords, ); return $this-&gt;doApiRequest('findItemsByKeywords', $params); } private function doApiRequest($operationName, $payload) { $global = array( 'OPERATION-NAME' =&gt; $operationName, 'SECURITY-APPNAME' =&gt; $this-&gt;appId, 'GLOBAL-ID' =&gt; 'EBAY-US', 'SERVICE-VERSION' =&gt; '1.0.0', 'MESSAGE-ENCODING' =&gt; 'UTF-8', 'RESPONSE-DATA-FORMAT' =&gt; 'JSON', ); $ret = file_get_contents( self::FINDING_API_URL . http_build_query($global) . '&amp;REST-PAYLOAD&amp;' . http_build_query($payload) ); return $ret; } } </code></pre> <p>Method 'findItemsByKeywords' works Ok, but 'findItemsByProduct' still returns error ('Invalid product ID value.'). I tried different variants of passing value, but it doesn't work :( Current version of passing value I saw here: <a href="https://stackoverflow.com/questions/4110440/how-to-use-python-xml-etree-elementtree-to-parse-ebay-api-response">how to use python xml.etree.ElementTree to parse eBay API response?</a></p> <p>Usage:</p> <pre><code>&lt;?php $eBay = new MyProject_Model_Ebay( 'My-app-id' ); $eBay-&gt;findByProduct('4719331316129'); </code></pre> <p>Response:</p> <pre><code>{"findItemsByProductResponse":[{"ack":["Failure"],"errorMessage":[{"error":[{"errorId":["41"],"domain":["Marketplace"],"severity":["Error"],"category":["Request"],"message":["Invalid product ID value."],"subdomain":["Search"],"parameter":["4719331316129"]}]}],"version":["1.11.1"],"timestamp":["2012-03-14T06:41:42.600Z"]}]} </code></pre> <p>Important! If i change GLOBAL-ID on EBAY-DE, for example, everything is OK! What's wrong with EBAY-US?!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload