<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>zanox Web Services &#38; Application Store Blog &#187; HowTo</title>
	<atom:link href="http://blog.zanox.com/en/webservices/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zanox.com/en/webservices</link>
	<description>Build Revenue From Your Creativity</description>
	<lastBuildDate>Mon, 16 Nov 2009 17:56:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>zanox Connect step by step guide for developers</title>
		<link>http://blog.zanox.com/en/webservices/2009/09/15/zanox-connect-step-by-step-guide-for-developers/</link>
		<comments>http://blog.zanox.com/en/webservices/2009/09/15/zanox-connect-step-by-step-guide-for-developers/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 08:29:48 +0000</pubDate>
		<dc:creator>Francesco Votta</dc:creator>
				<category><![CDATA[Application Store]]></category>
		<category><![CDATA[HowTo]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=939</guid>
		<description><![CDATA[	

More details can be found here 

	
 ]]></description>
			<content:encoded><![CDATA[	<p><span style="font-size: x-small; font-family: Helv;"><span style="font-size: x-small; font-family: Helv;"><br />
<p dir="ltr"><object width="383" height="200"><param name="movie" value="http://www.youtube.com/v/eCHEbdXOQEA&#038;hl=de&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/eCHEbdXOQEA&#038;hl=de&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object></p><br />
<p dir="ltr">More details can be found <a title="zanox Connect guide" href="http://wiki.zanox.com/en/Zanox_Connect_Getting_Started_Guide" target="_blank">here </a></p></p>

	<p></span></span></p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2009/09/15/zanox-connect-step-by-step-guide-for-developers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>zanox Web Services Workshop 1.0</title>
		<link>http://blog.zanox.com/en/webservices/2009/04/15/zanox-web-services-workshop-10/</link>
		<comments>http://blog.zanox.com/en/webservices/2009/04/15/zanox-web-services-workshop-10/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 20:40:29 +0000</pubDate>
		<dc:creator>Sebastian Wallroth</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Widget production]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=711</guid>
		<description><![CDATA[	Welcome to the workshop. I want to explore with you the possibilities zanox Web Services offers you.

	First let&#8217;s have a look at this plain product search example taken from our wiki. It consists of a HTML file containing JavaScript code.

	
&#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD HTML 4.01 Transitional//EN&#34; &#34;http://www.w3.org/TR/html4/loose.dtd&#34;&#62;
&#60;html&#62;
 &#60;head&#62;
  &#60;title&#62;zanox Web Services - Contextual Product [...]]]></description>
			<content:encoded><![CDATA[	<p>Welcome to the workshop. I want to explore with you the possibilities zanox Web Services offers you.</p>

	<p>First let&#8217;s have a look at this plain product search example <a href="http://wiki.zanox.com/en/JavaScript_Contextual_Product_Search" target="_blank">taken from our wiki</a>. It consists of a <span class="caps">HTML</span> file containing JavaScript code.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="null" style="font-family:monospace;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;zanox Web Services - Contextual Product Search&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;zanox Web Services - Contextual Product Search&lt;/h1&gt;
  &lt;div id=&quot;zxAdList&quot;&gt;&lt;/div&gt; &lt;!-- // DIV HTML element to be filled with product information --&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
// function to add scripts to html header 
   function addScript(url) { 
    var script = document.createElement('script');
// preventing caching of the Web Service call by adding timestamp
    script.src = url + '&amp;t=' + new Date().getMinutes(); 
    script.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(script);
   }
&nbsp;
// function for zanox product search  
// for detailed parameter description see 
// http://wiki.zanox.com/en/Products_Resource#GET:_Contextual_product_search
   function productSearch(version, applicationid, adspace, region, programs, minPrice, maxPrice, category, page, items, q, callback) {
    var url = 'http://api.zanox.com/json/' + version + '/products?applicationid=' + applicationid;
// adspace=null returns tracking links for all adspaces 
    if (adspace) url += '&amp;adspace=' + adspace;
// sales region; e.g. de, fr, it; null means &quot;all countries&quot;
    if (region) url += '&amp;region=' + region;
// program ID 
    if (programs) url += '&amp;programs=' + programs;
// zanox product category ID; null means &quot;all categories&quot;  
    if (category) url += '&amp;category=' + category;
// search result is paged 
    if (page) url += '&amp;page=' + page;
// number of products per page 
    if (items) url += '&amp;items=' + items;
// minimum price 
    if (minPrice) url += '&amp;minPrice=' + minPrice;
// maximum price 
    if (maxPrice) url += '&amp;maxPrice=' + maxPrice;
// handler for the search result 
    if (callback) url += '&amp;callback=' + callback;
// search term 
    if (q) url += '&amp;q=' + q;
// adding script to html header 
    addScript(url);
   }
&nbsp;
// function for computing of the search result 
   function handler(data) {
    if (data.productsResult) {
     var productItems = data.productsResult.productItem;
// accessing the existing div element with the ID &quot;zxAdList&quot; 
     var theList = document.getElementById('theList');
// looping through the product results 
     for (var i = 0; i &lt; productItems.length; i++) {
      var productItem = productItems[i];
      var link = '';
      if (productItem.url.adspace instanceof Array) {
// selecting tracking link related to the first adspace
      link = productItem.url.adspace[0].$; 
      }
      else {
       link = productItem.url.adspace.$;
      }
// creating a list item &lt;li&gt;&lt;a href=&quot;PRODUCT LINK&quot;&gt;PRODUCT NAME at ADVERTISER only PRODUCT PRICE&lt;/a&gt;&lt;/li&gt;
      var item = document.createElement(&quot;li&quot;);
      item.innerHTML = &quot;&lt;a href='&quot; + link + &quot;'&gt;&quot; + productItem.name + &quot; at &quot; + productItem.program.$ + &quot; only &quot; + productItem.price.toFixed(2) + &quot;&amp;nbsp;&quot; + productItem.currency + &quot;&lt;/a&gt;&quot;;
// appending item to theList
      theList.appendChild(item);
     }
    }
   }
&nbsp;
// creating an unordered list &lt;ul id=&quot;theList&quot;&gt;&lt;/ul&gt; 
   var theList = document.createElement(&quot;ul&quot;);
   theList.setAttribute(&quot;id&quot;,&quot;theList&quot;);
// accessing the existing div element with the ID &quot;zxAdList&quot; 
   var zxAdList = document.getElementById('zxAdList');
// adding theList to zxAdList
   zxAdList.appendChild(theList);
&nbsp;
// performing the zanox search 
   productSearch('2009-02-01', 'BE94C4947839E8AB4D67', null, null, '660', null, null, null, 0, 5, 'red towel', 'handler');
&lt;/script&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre></div></div>
</p>



	<p>You can copy this code as it is into a text file, then save the file as a.html and view it in a browser. It should look quite similar to this screenshot: <img src="http://blog.zanox.com/en/webservices/wp-content/uploads/2009/04/2009-04-15_184055.jpg" alt="Screenshot" title="screenshot" width="422" height="287" class="alignright size-full wp-image-743" /></p>

	<p>Let&#8217;s go through the code.</p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>zanox Web Services - Contextual Product Search<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>zanox Web Services - Contextual Product Search<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;zxAdList&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> <span style="color: #808080; font-style: italic;">&lt;!-- // DIV HTML element to be filled with product information --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>
</p>



	<p>The first lines are the <span class="caps">HTML</span> part of the file. In line 7 the huge headline is created and in line 8 a <span class="caps">DIV</span> container is placed to be filled with our Web Service output.</p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// function to add scripts to html header </span>
<span style="color: #003366; font-weight: bold;">function</span> addScript<span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #003366; font-weight: bold;">var</span> script <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// preventing caching of the Web Service call by adding timestamp</span>
script.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> url <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;t='</span> <span style="color: #339933;">+</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
script.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">;</span>
document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>script<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>
</p>



	<p>The function addScript() starting at line 11 takes a given <span class="caps">URL</span>. Then it creates in line 12 a new script in our <span class="caps">HTML</span> document like if we would add a <code>&lt;script&gt;&lt;/script&gt;</code> tag into the <span class="caps">HTML</span> code. In line 14 the parameter <code>src</code> is added to the <code>script</code> object and filled with the given <span class="caps">URL</span> like if we would extend the <code>script</code> tag to <code>&lt;script src="url"&gt;&lt;/script&gt;</code>.<br />
<blockquote>The magic part <code>+ '&#38;t=' + new Date().getMinutes()</code> adds a timestamp to the <span class="caps">URL</span>. This doesn&#8217;t influent the script but prevents caching of the Web Service request. If we would strip the magic code, we would recieve always the same products even if we would use different search terms.</blockquote><br />
In line 16 we add the script to the <span class="caps">HTML HEAD</span> section. Do you know why?<br />
<dl><dt>Wouldn&#8217;t it work also if we would include the script from within the <span class="caps">HTML BODY</span> section?</dt><br />
<dd>We have to add it to the <span class="caps">HTML HEAD</span> section, because we are calling a <span class="caps">URL</span> of another domain. The script is placed on your server and calls the zanox Web Service <span class="caps">URL</span>. If we would put the script into the <span class="caps">HTML BODY</span> this would lead to a security warning or an error. But doing it from within the <span class="caps">HTML HEAD</span> section there is no problem.</dd><br />
<dt>Why don&#8217;t we put the script into the <span class="caps">HTML HEAD</span> section manually?</dt><br />
<dd>Because we are programing a widget. Widgets are added to the <span class="caps">HTML BODY</span> section per definitionem.</dd></dl></p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// function for zanox product search  </span>
<span style="color: #006600; font-style: italic;">// for detailed parameter description see </span>
<span style="color: #006600; font-style: italic;">// http://wiki.zanox.com/en/Products_Resource#GET:_Contextual_product_search</span>
   <span style="color: #003366; font-weight: bold;">function</span> productSearch<span style="color: #009900;">&#40;</span>version<span style="color: #339933;">,</span> applicationid<span style="color: #339933;">,</span> adspace<span style="color: #339933;">,</span> region<span style="color: #339933;">,</span> programs<span style="color: #339933;">,</span> minPrice<span style="color: #339933;">,</span> maxPrice<span style="color: #339933;">,</span> category<span style="color: #339933;">,</span> page<span style="color: #339933;">,</span> items<span style="color: #339933;">,</span> q<span style="color: #339933;">,</span> callback<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> url <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://api.zanox.com/json/'</span> <span style="color: #339933;">+</span> version <span style="color: #339933;">+</span> <span style="color: #3366CC;">'/products?applicationid='</span> <span style="color: #339933;">+</span> applicationid<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// adspace=null returns tracking links for all adspaces </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>adspace<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;adspace='</span> <span style="color: #339933;">+</span> adspace<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// sales region; e.g. de, fr, it; null means &quot;all countries&quot;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>region<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;region='</span> <span style="color: #339933;">+</span> region<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// program ID </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>programs<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;programs='</span> <span style="color: #339933;">+</span> programs<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// zanox product category ID; null means &quot;all categories&quot;  </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>category<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;category='</span> <span style="color: #339933;">+</span> category<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// search result is paged </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>page<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;page='</span> <span style="color: #339933;">+</span> page<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// number of products per page </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>items<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;items='</span> <span style="color: #339933;">+</span> items<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// minimum price </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>minPrice<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;minPrice='</span> <span style="color: #339933;">+</span> minPrice<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// maximum price </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>maxPrice<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;maxPrice='</span> <span style="color: #339933;">+</span> maxPrice<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// handler for the search result </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>callback<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;callback='</span> <span style="color: #339933;">+</span> callback<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// search term </span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>q<span style="color: #009900;">&#41;</span> url <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&amp;q='</span> <span style="color: #339933;">+</span> q<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// adding script to html header </span>
    addScript<span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>
</p>



	<p>The function productSearch() performes the zanox product search. Basically we are building a <span class="caps">URL</span> calling the product search service and handing over several parameters. Please refer to <a href="http://wiki.zanox.com/en/Products_Resource#GET:_Contextual_product_search">the zanox wiki</a> to see the complete documentation. In line 22 we are starting to build the <span class="caps">URL</span> with <code>http://api.zanox.com/json/</code>, adding the folder of the current <code>version</code>, the method <code>product</code>, and the application ID as the first parameter.<br />
<dl><dt>Where do I get my application ID?</dt><br />
<dd>Go to <a href="http://www.zanox.com" target="_blank">http://www.zanox.com</a>. Login using the top right form. Activate the tab <em>Web Services (BETA)</em> and grab the application ID from the table or create a new one using the button.</dd></dl></p>
	<p>The next parameters are filters for the search. Then in line 40 the handler for the result is defined. Finally in line 44 the prior function addScript() is called to move the Web Services call into the <span class="caps">HTML HEAD</span> section which leads to an instant execution of it.</p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// function for computing of the search result </span>
   <span style="color: #003366; font-weight: bold;">function</span> handler<span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>data.<span style="color: #660066;">productsResult</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #003366; font-weight: bold;">var</span> productItems <span style="color: #339933;">=</span> data.<span style="color: #660066;">productsResult</span>.<span style="color: #660066;">productItem</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// accessing the existing div element with the ID &quot;zxAdList&quot; </span>
     <span style="color: #003366; font-weight: bold;">var</span> theList <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'theList'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// looping through the product results </span>
     <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> productItems.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> productItem <span style="color: #339933;">=</span> productItems<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> link <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>productItem.<span style="color: #660066;">url</span>.<span style="color: #660066;">adspace</span> <span style="color: #000066; font-weight: bold;">instanceof</span> Array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// selecting tracking link related to the first adspace</span>
      link <span style="color: #339933;">=</span> productItem.<span style="color: #660066;">url</span>.<span style="color: #660066;">adspace</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.$<span style="color: #339933;">;</span> 
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
       link <span style="color: #339933;">=</span> productItem.<span style="color: #660066;">url</span>.<span style="color: #660066;">adspace</span>.$<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">// creating a list item &lt;li&gt;&lt;a href=&quot;PRODUCT LINK&quot;&gt;PRODUCT NAME at ADVERTISER only PRODUCT PRICE&lt;/a&gt;&lt;/li&gt;</span>
      <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&lt;a href='&quot;</span> <span style="color: #339933;">+</span> link <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;'&gt;&quot;</span> <span style="color: #339933;">+</span> productItem.<span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; at &quot;</span> <span style="color: #339933;">+</span> productItem.<span style="color: #660066;">program</span>.$ <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; only &quot;</span> <span style="color: #339933;">+</span> productItem.<span style="color: #660066;">price</span>.<span style="color: #660066;">toFixed</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&amp;nbsp;&quot;</span> <span style="color: #339933;">+</span> productItem.<span style="color: #660066;">currency</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// appending item to theList</span>
      theList.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>
</p>



	<p>The function handler(data) catches the result delivered in the container <code>data.productsResult</code>. The products are stored in the array <code>data.productsResult.productItem</code> In line 51 we are creating a handler for the list where we want to put the single product items in. Beginning in line 53 we are looping through the products.<br />
For every product we have the following data. (This is the example from the <a href="http://wiki.zanox.com/en/Products_Resource#Example_Response">zanox Web Services documentation in our wiki</a>.)</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span> <span style="color: #000066;">standalone</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;response</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://api.zanox.com/namespace/2009-02-01/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;productsResult<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;productItem</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;76485b5f7021f7bc03b853fbf5debb53&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Example product<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modified<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-06-01T17:00:00Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modified<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Description of the example product item<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manufacturer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Example Inc.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manufacturer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;program</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;333&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Example Inc. advertising program<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/program<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;currency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>EUR<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/currency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>39.90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;10000&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3817610347<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;small<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.example.com/productimage/71/BTP/4X_20425_3028.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/small<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;medium<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.example.com/productimage/71/bp/4X_20425_3028.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/medium<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;large<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.example.com/productimage/71/BM/4X_20425_3028.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/large<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/image<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;adspace</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>http://www.zanox-affiliate.de/ppc/77171C831740488ULP=[[000697]]<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/adspace<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;adspace</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>http://www.zanox-affiliate.de/ppc/77172C832740488ULP=[[000697]]<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/adspace<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;adspace</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;3&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>http://www.zanox-affiliate.de/ppc/77173C833740488ULP=[[000697]]<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/adspace<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/productItem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/productsResult<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/response<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>
</p>



	<p>Please keep in mind that only the attributes <ul><li>productItem id</li><br />
<li>name</li><br />
<li>modified</li><br />
<li>manufacturer</li><br />
<li>program id</li><br />
<li>currency</li><br />
<li>category id</li></ul> are always available.</p>

	<p>Also the image urls are not supervised by zanox. Sometimes there are no ones. Sometimes the url format is wrong. Sometimes instead of a product image an image with a text like &#8220;No image&#8221; is delivered.</p>

	<p>The description sometime includes (bad) <span class="caps">HTML</span> code.</p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>71
72
73
74
75
76
77
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// creating an unordered list &lt;ul id=&quot;theList&quot;&gt;&lt;/ul&gt; </span>
   <span style="color: #003366; font-weight: bold;">var</span> theList <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   theList.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;theList&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// accessing the existing div element with the ID &quot;zxAdList&quot; </span>
   <span style="color: #003366; font-weight: bold;">var</span> zxAdList <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'zxAdList'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// adding theList to zxAdList</span>
   zxAdList.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>theList<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>
</p>



	<p>In lines 72 to 77 we are creating a unordered list and appending it to the <span class="caps">DIV</span> container established in line 8. (This list is filled with LI items in lines 64 to 67.)</p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>78
79
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// performing the zanox search </span>
   productSearch<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'2009-02-01'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'BE94C4947839E8AB4D67'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'660'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'red towel'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'handler'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>
</p>



	<p>In line 79 the function productSearch() is called handing over the parameters<br />
<ol></p>
	<p><li>Version &#8211; the zanox Web Services version &#8211; <code>2009-02-01</code></li><br />
<li>Application <span class="caps">ID </span>- place your application ID here; the current is mine (you <span class="caps">CAN</span> use, but it&#8217;s ME earning the money then ) &#8211; <code>BE94C4947839E8AB4D67</code></li><br />
<li>AdSpace <span class="caps">ID </span>- you can append the transactions to a dedicated advertising space of yours &#8211; <code>null</code></li><br />
<li>Region &#8211; filters the result set to products for one country here, e.g. France or Kenia &#8211; <code>null</code></li><br />
<li>Programs &#8211; filters the result set to one advertiser &#8211; <code>660</code></li><br />
<li>Minimum price &#8211; filters the result set to products mre expensive than this &#8211; <code>null</code></li><br />
<li>Maximum price &#8211; filters the result set to products cheaper than this &#8211; <code>null</code></li><br />
<li>Category &#8211; filters the result set to one zanox product category &#8211; <code>null</code></li><br />
<li>Page &#8211; the result set is splitted into pages; only the products of the page set here will be displayed &#8211; <code>0</code></li><br />
<li>Items &#8211; number of products per page &#8211; <code>5</code></li><br />
<li>Search term &#8211; what we are searching for &#8211; <code>red towel</code></li><br />
<li>callback &#8211; access key to the result set &#8211; <code>handler</code></li><br />
</ol></p>
	<p><strong>Playtime!</strong> You can play with some filters now. Try this:</p>

	<p><code>productSearch('2009-02-01', 'BE94C4947839E8AB4D67', null, 'de', '660', null, null, null, 0, 25, 'Rolling Stones', 'handler');</code></p>

	<p><code>productSearch('2009-02-01', 'BE94C4947839E8AB4D67', null, 'se', '660', 8, 20, null, 0, 5, 'Sweater', 'handler');</code></p>

	<p><code>productSearch('2009-02-01', 'BE94C4947839E8AB4D67', null, 'fr', '660', 200, 500, null, 0, 10, 'South Korean Samsung Electronics plans to launch a new generation refrigerator, equipped with RFID, which detects when its contents are running low or approaching expiration dates', 'handler');</code></p>

	<p>Finally we are closing the file &#8230;</p>

	<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>80
81
82
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>
</p>


	<p>... and the workshop. See you next time!</p>

 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2009/04/15/zanox-web-services-workshop-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to monetize your blog, part I</title>
		<link>http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/</link>
		<comments>http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 14:09:59 +0000</pubDate>
		<dc:creator>Daniel Neubauer</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Showcases]]></category>
		<category><![CDATA[Widget production]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[contextual]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonp]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=639</guid>
		<description><![CDATA[	This tutorial shows how to monetize blogs using zanox Web Services.

	Part-I of this tutorial will focus on blogger.com.

	So everything you&#8217;ll need to do is:

	Open your Blog Layout at blogger.com (screen 1)
Create a new HTML/Script Gadget (screen 2)
Use the the Widget Source Code from snipplr as content for the HTML/Script Gadget (screen 3)
Replace the ApplicationId in [...]]]></description>
			<content:encoded><![CDATA[	<p>This tutorial shows how to monetize blogs using zanox Web Services.</p>

	<p>Part-I of this tutorial will focus on blogger.com.</p>

	<p>So everything you&#8217;ll need to do is:<br />
<ol></p>
	<p><li>Open your Blog Layout at blogger.com (screen 1)</li><br />
<li>Create a new <span class="caps">HTML</span>/Script Gadget (screen 2)</li><br />
<li>Use the the Widget Source Code from <a title="Widget Script Code" href="http://snipplr.com/view/13746/zanox-web-services--contextual-product-search-widget-for-bloggercom/" target="_blank">snipplr</a> as content for the <span class="caps">HTML</span>/Script Gadget (screen 3)</li><br />
<li>Replace the ApplicationId in the source example with yours and start writing content.</li><br />
</ol></p>
	<p>As you can see at screen 4, the new Gadget shows product data offers as a list of text links, always related to the headline of your blog entry.</p>

	<p>Running live example: <a title="Showcase Blog" href="http://showcaseblog.blogspot.com/" target="_blank">http://showcaseblog.blogspot.com/</a></p>

	<p>Have fun!</p>

	<p>
<a href='http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/2009-04-03_layout/' title='2009-04-03_layout'><img width="150" height="150" src="http://blog.zanox.com/en/webservices/wp-content/uploads/2009/04/2009-04-03_layout-150x150.png" class="attachment-thumbnail" alt="" title="2009-04-03_layout" /></a>
<a href='http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/2009-04-03_addgadget/' title='2009-04-03_addgadget'><img width="150" height="150" src="http://blog.zanox.com/en/webservices/wp-content/uploads/2009/04/2009-04-03_addgadget-150x150.png" class="attachment-thumbnail" alt="" title="2009-04-03_addgadget" /></a>
<a href='http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/2009-04-03_pastecode/' title='2009-04-03_pastecode'><img width="150" height="150" src="http://blog.zanox.com/en/webservices/wp-content/uploads/2009/04/2009-04-03_pastecode-150x150.png" class="attachment-thumbnail" alt="" title="2009-04-03_pastecode" /></a>
<a href='http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/2009-04-03_final/' title='2009-04-03_final'><img width="150" height="150" src="http://blog.zanox.com/en/webservices/wp-content/uploads/2009/04/2009-04-03_final-150x150.png" class="attachment-thumbnail" alt="" title="2009-04-03_final" /></a>
</p>

	<p><a title="Widget Script Code" href="http://snipplr.com/view/13746/zanox-web-services--contextual-product-search-widget-for-bloggercom/" target="_blank"></a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2009/04/03/how-to-monetize-your-blog-part-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Download updated products with zanox Web Services</title>
		<link>http://blog.zanox.com/en/webservices/2009/04/03/download-updated-products-with-zanox-web-services/</link>
		<comments>http://blog.zanox.com/en/webservices/2009/04/03/download-updated-products-with-zanox-web-services/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 10:00:36 +0000</pubDate>
		<dc:creator>mira</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[modified]]></category>
		<category><![CDATA[products]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=627</guid>
		<description><![CDATA[	How to keep your product data in sync using zanox Web Services and the latest feature &#8220;Download by last modified date&#8221;. Instead of downloading the hole product data feed, you can just download the latest changes.

	

	

Read more about this in our Wiki
 ]]></description>
			<content:encoded><![CDATA[	<p>How to keep your product data in sync using zanox Web Services and the latest feature &#8220;Download by last modified date&#8221;. Instead of downloading the hole product data feed, you can just download the latest changes.</p>

	<p><object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/Ghdm6e1Txm8&#38;hl=de&#38;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Ghdm6e1Txm8&#38;hl=de&#38;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="430" height="240"></embed></object></p>

	<p><br />
<br />
<a href="http://wiki.zanox.com/en/Products_Resource#GET:_Retrieving_product_items_by_advertiser_program">Read more about this in our Wiki</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2009/04/03/download-updated-products-with-zanox-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Web Service code examples</title>
		<link>http://blog.zanox.com/en/webservices/2009/03/13/more-web-service-code-examples/</link>
		<comments>http://blog.zanox.com/en/webservices/2009/03/13/more-web-service-code-examples/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 17:19:06 +0000</pubDate>
		<dc:creator>Sebastian Wallroth</dc:creator>
				<category><![CDATA[HowTo]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=437</guid>
		<description><![CDATA[	A lot of ideas whir around here for Web Service code examples. But we have to focus on the development of the Web Services. Nevertheless some nitty gritty pieces of software are to be found in the zanox Web Services Wiki. There is a special section &#8220;Quick-Start Tutorials&#8221; growing day by day. We would like [...]]]></description>
			<content:encoded><![CDATA[	<p><img class="alignright size-thumbnail wp-image-438" title="zxwsproductcarrousel" src="http://blog.zanox.com/en/webservices/wp-content/uploads/2009/03/zxwsproductcarrousel-150x150.jpg" alt="zxwsproductcarrousel" width="150" height="150" />A lot of ideas whir around here for Web Service code examples. But we have to focus on the development of the Web Services. Nevertheless some nitty gritty pieces of software are to be found in the <a href="http://wiki.zanox.com/en/Web_Services">zanox Web Services Wiki</a>. There is a special section &#8220;<a href="http://wiki.zanox.com/en/Web_Services#Quick-Start_Tutorials">Quick-Start Tutorials</a>&#8221; growing day by day. We would like to encourage you to provide some code examples to the zanox Web Service Developer community. Today we picked these three examples.<br />
<ul></p>
	<p><li>The <a href="http://wiki.zanox.com/en/JavaScript_Product_Carrousel">product carrousel</a> is a real eyecatcher written in JavaScript.</li><br />
<li>The <a href="http://wiki.zanox.com/en/JavaScript_Contextual_Product_Search">Contextual Product Search Example</a> needs a little more than 50 lines of code only to demonstrate a search within the 57 million products of the zanox data base.</li><br />
<li>The <a href="http://wiki.zanox.com/en/PHP_SOAP_Account_Browser"><span class="caps">PHP SOAP </span>Account browser</a> showcases the usage of the payment, the report and the adspace resources.</li><br />
</ul></p>
	<p>Best of all: these examples are fully functional. Download them, modify the code and bring your monetization 2.0 ideas into being.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2009/03/13/more-web-service-code-examples/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to create dynamic ads using zanox contextual product search</title>
		<link>http://blog.zanox.com/en/webservices/2009/02/27/how-to-create-dynamic-ads-using-zanox-contextual-product-search/</link>
		<comments>http://blog.zanox.com/en/webservices/2009/02/27/how-to-create-dynamic-ads-using-zanox-contextual-product-search/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 09:57:47 +0000</pubDate>
		<dc:creator>Daniel Neubauer</dc:creator>
				<category><![CDATA[HowTo]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=334</guid>
		<description><![CDATA[	This article shows how to create dynamic admedia based on the contextual product search, which is part of the zanox Web Services. In general you can follow a&#160; server-side or client-side approach.&#160; Here we will do this client-side using JS, so all API calls are done by the visitors browser and you don&#8217;t need any [...]]]></description>
			<content:encoded><![CDATA[	<p>This article shows how to create dynamic admedia based on the contextual product search, which is part of the zanox Web Services. In general you can follow a&#160; server-side or client-side approach.&#160; Here we will do this client-side using JS, so all <span class="caps">API</span> calls are done by the visitors browser and you don&#8217;t need any serious code running on a web-server. This way it&#8217;s easy to adopt and integrate it into your next webpage-, blog- or widgets-project.</p>

	<p>To develop a dynamic ad, we will take the following steps:<br />
<ol></p>
	<p><li>Creating zanox Web Services credentials</li><br />
<li><span class="caps">RES</span>Tful products resource &#038; contextual product search</li><br />
<li>Crossdomain: Calling zanox Web Services using <span class="caps">JSONP</span></li><br />
<li>Parse response data</li><br />
</ol></p>
	<p><strong>1. Creating zanox Web Services credentials</strong></p>

	<p>Login to zanox, click on the new tab &#8220;Web Services <span class="caps">BETA</span>&#8221;. At&#160; the Web Services tab, create a new applicationId or grab an existing one. In this article, we just need the applicationId. The applicationId is responsible to get your tracking codes into the dynamic ads. You can make it public but don&#8217;t do this with your sharedKey, it&#8217;s nearly as mighty as your password. <em></em></p>

	<p><em>Please note: If you don&#8217;t have an account yet, you have to <a title="Register" href="https://ui.zanox-affiliate.de/bin/z_in_frm.dll?1001100210030&#038;0C0&#038;122219_111_341_54224" target="_blank">register to continue</a>. The first time using the Web Services tab, you have to press an apply for &#8220;zanox Web Services&#8221;-button and to re-enter the Web Services tab again.</em></p>

	<p><strong>2. <span class="caps">RES</span>Tful products resource &#038; contextual product search</strong></p>

	<p>zanox Web Services offer the same functionality for <span class="caps">SOAP</span>, REST-XML and <span class="caps">REST</span>-JSON, so you can choose case by case what&#8217;s matching your requirements.&#160; We&#8217;re going to use Java Script in our case, so we take the <span class="caps">REST</span>-JSON <span class="caps">API</span>. The products resource supports the simple <span class="caps">URL</span> parameter authentification, which allows to append the applicationId as a <span class="caps">URL</span> parameter. To give it a try, just type the following into your browser and replace <span class="caps">ABC123</span> with your applicationId:</p>

	<p>http://api.zanox.com/json/products?applicationid=ABC123&#038;q=jeans</p>

	<p>The response contains then number of products matching the query and by default shows the first 10 items.&#160; For each item there is at least name, price, description, up to three images available.&#160; In addition category and <span class="caps">EAN</span> if available.</p>

	<p>The parameter &#8220;q&#8221; defines the search query. You can search for products by using a short string or a name of a product, or by using a longer text phrase for contextual matching. To specify the search, there are some more parameters like region, minPrice, maxPrice, category and programs and adspace.</p>

	<p>Read more about the products resource in the zanox wiki:</p>

	<p><a title="Products Resource, Contextual product search" href="http://wiki.zanox.com/en/Products_Resource#GET:_Contextual_product_search" target="_blank">http://wiki.zanox.com/en/Products_Resource#GET:_Contextual_product_search</a> <strong></strong></p>

	<p><strong>3. Crossdomain: Calling zanox Web Services using <span class="caps">JSONP</span></strong></p>

	<p>In our client-side scenario, the <span class="caps">API</span> calls to api.zanox.com are done by the browser of the visitors of your website.&#160; To support this scenario,&#160; zanox Web Services support <a title="JSONP" href="http://en.wikipedia.org/wiki/JSON#JSONP" target="_blank"><span class="caps">JSONP</span></a>. You just pass the name of a Java Script callback handler function as a parameter when calling the zanox Web Services. The <span class="caps">JSON</span> result is wrapped into a Java Script function call.</p>

	<p>The idas is to implement the handler function and perform the <span class="caps">API</span>-call as a script refenrence from your web page:<br />
<blockquote>< script src="http://api.zanox.com/json/products?applicationid=ABC123&#038;q=jeans&#038;callback=handler" > < / script ></blockquote><br />
The response will be a call of a function name &#8220;handler&#8221; and look like this:<br />
<blockquote>handler(...json result of the query&#8230;);</blockquote><br />
To make it more dynamically, you can use the following helper function to add a script reference to your website:<br />
<blockquote>function addScript(url) {<br />
var script = document.createElement(&#8220;script&#8221;);<br />
script.src = url + &#8216;&#038;t=&#8217;+new Date().getMinutes();<br />
script.type = &#8220;text/javascript&#8221;;<br />
document.getElementsByTagName(&#8220;head&#8221;)[0].appendChild(script);<br />
}</blockquote><br />
Using this helper function, all the functionality of the contextual product search is already implemented in JS:<br />
<blockquote>function productSearch(version, applicationid, adspace, region, programs, minPrice, maxPrice, category, page, items, q, callback) {<br />
var url = &#8216;<a class="external free" title="http://api.zanox.com/json/'" rel="nofollow" href="http://api.zanox.com/json/%27">http://api.zanox.com/json/&#8217;</a> + version + &#8216;/products?applicationid=&#8217; + applicationid;<br />
if (adspace) url += &#8216;&#038;adspace=&#8217; + adspace;<br />
if (region) url += &#8216;&#038;region=&#8217; + region;<br />
if (programs) url += &#8216;&#038;programs=&#8217; + programs;<br />
if (category) url += &#8216;&#038;category=&#8217; + category;<br />
if (page) url += &#8216;&#038;page=&#8217; + page;<br />
if (items) url += &#8216;&#038;items=&#8217; + items;<br />
if (minPrice) url += &#8216;&#038;minPrice=&#8217; + minPrice;<br />
if (maxPrice) url += &#8216;&#038;maxPrice=&#8217; + maxPrice;<br />
if (callback) url += &#8216;&#038;callback=&#8217; + callback;<br />
if (q) url += &#8216;&#038;q=&#8217; + q; addScript(url);<br />
}</blockquote><br />
Read more about the Java Script helper functions and examples at: <a title="Java Script API Client" href="http://wiki.zanox.com/en/JavaScript_Client_Library" target="_blank">http://wiki.zanox.com/en/JavaScript_Client_Library</a> <strong></strong></p>

	<p><strong>4. Parse response data</strong></p>

	<p>In order to render the product search response, we have to access the product Items inside of the <span class="caps">JSON</span> response. You can just use the following lines of code:<br />
<blockquote>function handler(data) {<br />
if (data.productsResult) {<br />
var productItems = data.productsResult.productItem;</p>

	<p>for (var i = 0; i < productItems.length; i++) {<br />
var productItem = productItems[i];<br />
//..do something with productItem<br />
}</p>
	<p>}<br />
}</blockquote><br />
So have fun with this code snippets,&#160; I hope this helps you creating widgets and gives you some ideas of integrating our contextual product search into your websites. Feel free to comment some of your implementations in our blog.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2009/02/27/how-to-create-dynamic-ads-using-zanox-contextual-product-search/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>zanox PHP API Client released</title>
		<link>http://blog.zanox.com/en/webservices/2008/09/26/zanox-php-api-client-released/</link>
		<comments>http://blog.zanox.com/en/webservices/2008/09/26/zanox-php-api-client-released/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 06:59:05 +0000</pubDate>
		<dc:creator>dka</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Client]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=202</guid>
		<description><![CDATA[In order to use the zanox Web Services with PHP zanox released a PHP API Client Toolkit. 

]]></description>
			<content:encoded><![CDATA[	<p>In order to use the zanox Web Services with <span class="caps">PHP</span> zanox released a <span class="caps">PHP API </span>Client Toolkit.</p>

	<p>To accelerate your development efforts we provide a <span class="caps">PHP API </span>Client that you can download and use to simplify monetization of your application.</p>

	<p>Please see the <a href="http://wiki.zanox.com/en/Zanox_PHP_API_Client">wiki</a> for how to install and use this <a href="http://wiki.zanox.com/en/Zanox_PHP_API_Client">official zanox <span class="caps">PHP API</span> client</a>.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2008/09/26/zanox-php-api-client-released/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Getting Started Tutorials online</title>
		<link>http://blog.zanox.com/en/webservices/2008/07/20/getting-started-tutorials-online/</link>
		<comments>http://blog.zanox.com/en/webservices/2008/07/20/getting-started-tutorials-online/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 15:28:44 +0000</pubDate>
		<dc:creator>dka</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[lasso]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zanox.com/en/webservices/?p=103</guid>
		<description><![CDATA[Getting Started Tutorials are online]]></description>
			<content:encoded><![CDATA[	<p>Dear Developers,<br />
those of you which haven&#8217;t yet started to monetize their traffic and online resources with zanox webservices can now start immediately by using one of our freshly released <a href="http://wiki.zanox.com/en/Getting_Started_Tutorial">Getting Started Tutorials</a>.</p>

	<p>They are intended to newbies on webservices. Examples for <a href="http://wiki.zanox.com/en/PHP_Getting_Started_Example"><span class="caps">PHP</span>/Rest</a> and <a href="http://wiki.zanox.com/en/LASSO_Getting_Started_Example">Lasso/Rest</a> are included already. <span class="caps">SOAP</span>-Examples will follow soon.</p>

	<p>So get started now! Develop your applications with the zanox webservices.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://blog.zanox.com/en/webservices/2008/07/20/getting-started-tutorials-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
